diff options
Diffstat (limited to 'drivers/misc/sgi-gru/grukdump.c')
| -rw-r--r-- | drivers/misc/sgi-gru/grukdump.c | 17 | 
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/misc/sgi-gru/grukdump.c b/drivers/misc/sgi-gru/grukdump.c index 9b2062d1732..a3700a56b8f 100644 --- a/drivers/misc/sgi-gru/grukdump.c +++ b/drivers/misc/sgi-gru/grukdump.c @@ -139,8 +139,11 @@ static int gru_dump_context(struct gru_state *gru, int ctxnum,  	ubuf += sizeof(hdr);  	ubufcch = ubuf; -	if (gru_user_copy_handle(&ubuf, cch)) -		goto fail; +	if (gru_user_copy_handle(&ubuf, cch)) { +		if (cch_locked) +			unlock_cch_handle(cch); +		return -EFAULT; +	}  	if (cch_locked)  		ubufcch->delresp = 0;  	bytes = sizeof(hdr) + GRU_CACHE_LINE_BYTES; @@ -175,14 +178,10 @@ static int gru_dump_context(struct gru_state *gru, int ctxnum,  	hdr.cbrcnt = cbrcnt;  	hdr.dsrcnt = dsrcnt;  	hdr.cch_locked = cch_locked; -	if (!ret && copy_to_user((void __user *)uhdr, &hdr, sizeof(hdr))) -		ret = -EFAULT; - -	return ret ? ret : bytes; +	if (copy_to_user(uhdr, &hdr, sizeof(hdr))) +		return -EFAULT; -fail: -	unlock_cch_handle(cch); -	return -EFAULT; +	return bytes;  }  int gru_dump_chiplet_request(unsigned long arg)  | 
