diff options
Diffstat (limited to 'drivers/scsi/scsi_debug.c')
| -rw-r--r-- | drivers/scsi/scsi_debug.c | 19 | 
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index bebda917b138..8553277effb3 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -1511,8 +1511,6 @@ static int inquiry_vpd_b0(unsigned char *arr)  	put_unaligned_be64(sdebug_write_same_length, &arr[32]);  	return 0x3c; /* Mandatory page length for Logical Block Provisioning */ - -	return sizeof(vpdb0_data);  }  /* Block device characteristics VPD page (SBC-3) */ @@ -3785,7 +3783,7 @@ static int resp_write_scat(struct scsi_cmnd *scp,  		mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0);  		return illegal_condition_result;  	} -	lrdp = kzalloc(lbdof_blen, GFP_ATOMIC); +	lrdp = kzalloc(lbdof_blen, GFP_ATOMIC | __GFP_NOWARN);  	if (lrdp == NULL)  		return SCSI_MLQUEUE_HOST_BUSY;  	if (sdebug_verbose) @@ -4436,7 +4434,7 @@ static int resp_verify(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)  	if (ret)  		return ret; -	arr = kcalloc(lb_size, vnum, GFP_ATOMIC); +	arr = kcalloc(lb_size, vnum, GFP_ATOMIC | __GFP_NOWARN);  	if (!arr) {  		mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC,  				INSUFF_RES_ASCQ); @@ -4504,7 +4502,7 @@ static int resp_report_zones(struct scsi_cmnd *scp,  	rep_max_zones = (alloc_len - 64) >> ilog2(RZONES_DESC_HD); -	arr = kzalloc(alloc_len, GFP_ATOMIC); +	arr = kzalloc(alloc_len, GFP_ATOMIC | __GFP_NOWARN);  	if (!arr) {  		mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC,  				INSUFF_RES_ASCQ); @@ -5702,16 +5700,16 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,  			u64 ns = jiffies_to_nsecs(delta_jiff);  			if (sdebug_random && ns < U32_MAX) { -				ns = prandom_u32_max((u32)ns); +				ns = get_random_u32_below((u32)ns);  			} else if (sdebug_random) {  				ns >>= 12;	/* scale to 4 usec precision */  				if (ns < U32_MAX)	/* over 4 hours max */ -					ns = prandom_u32_max((u32)ns); +					ns = get_random_u32_below((u32)ns);  				ns <<= 12;  			}  			kt = ns_to_ktime(ns);  		} else {	/* ndelay has a 4.2 second max */ -			kt = sdebug_random ? prandom_u32_max((u32)ndelay) : +			kt = sdebug_random ? get_random_u32_below((u32)ndelay) :  					     (u32)ndelay;  			if (ndelay < INCLUSIVE_TIMING_MAX_NS) {  				u64 d = ktime_get_boottime_ns() - ns_from_boot; @@ -7340,7 +7338,10 @@ clean:  		kfree(sdbg_devinfo->zstate);  		kfree(sdbg_devinfo);  	} -	kfree(sdbg_host); +	if (sdbg_host->dev.release) +		put_device(&sdbg_host->dev); +	else +		kfree(sdbg_host);  	pr_warn("%s: failed, errno=%d\n", __func__, -error);  	return error;  }  |