Skip to content

Commit 3cde55e

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Five minor bug fixes. The libfc one is a tiny memory leak, the zfcp one is an incorrect user visible parameter and the rest are on error legs or obscure features" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: 53c700: pass correct "dev" to dma_alloc_attrs() scsi: bnx2fc: Fix error handling in probe() scsi: scsi_debug: fix write_same with virtual_gb problem scsi: libfc: free skb when receiving invalid flogi resp scsi: zfcp: fix sysfs block queue limit output for max_segment_size
2 parents b9de6ef + 8437fcf commit 3cde55e

File tree

6 files changed

+29
-27
lines changed

6 files changed

+29
-27
lines changed

drivers/s390/scsi/zfcp_aux.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ struct zfcp_adapter *zfcp_adapter_enqueue(struct ccw_device *ccw_device)
403403
goto failed;
404404

405405
/* report size limit per scatter-gather segment */
406-
adapter->dma_parms.max_segment_size = ZFCP_QDIO_SBALE_LEN;
407406
adapter->ccw_device->dev.dma_parms = &adapter->dma_parms;
408407

409408
adapter->stat_read_buf_num = FSF_STATUS_READS_RECOM;

drivers/s390/scsi/zfcp_scsi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,8 @@ static struct scsi_host_template zfcp_scsi_host_template = {
428428
.max_sectors = (((QDIO_MAX_ELEMENTS_PER_BUFFER - 1)
429429
* ZFCP_QDIO_MAX_SBALS_PER_REQ) - 2) * 8,
430430
/* GCD, adjusted later */
431+
/* report size limit per scatter-gather segment */
432+
.max_segment_size = ZFCP_QDIO_SBALE_LEN,
431433
.dma_boundary = ZFCP_QDIO_SBALE_LEN - 1,
432434
.shost_attrs = zfcp_sysfs_shost_attrs,
433435
.sdev_attrs = zfcp_sysfs_sdev_attrs,

drivers/scsi/53c700.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ NCR_700_detect(struct scsi_host_template *tpnt,
295295
if(tpnt->sdev_attrs == NULL)
296296
tpnt->sdev_attrs = NCR_700_dev_attrs;
297297

298-
memory = dma_alloc_attrs(hostdata->dev, TOTAL_MEM_SIZE, &pScript,
298+
memory = dma_alloc_attrs(dev, TOTAL_MEM_SIZE, &pScript,
299299
GFP_KERNEL, DMA_ATTR_NON_CONSISTENT);
300300
if(memory == NULL) {
301301
printk(KERN_ERR "53c700: Failed to allocate memory for driver, detaching\n");

drivers/scsi/bnx2fc/bnx2fc_io.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba)
240240
return NULL;
241241
}
242242

243+
cmgr->hba = hba;
243244
cmgr->free_list = kcalloc(arr_sz, sizeof(*cmgr->free_list),
244245
GFP_KERNEL);
245246
if (!cmgr->free_list) {
@@ -256,7 +257,6 @@ struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba)
256257
goto mem_err;
257258
}
258259

259-
cmgr->hba = hba;
260260
cmgr->cmds = (struct bnx2fc_cmd **)(cmgr + 1);
261261

262262
for (i = 0; i < arr_sz; i++) {
@@ -295,7 +295,7 @@ struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba)
295295

296296
/* Allocate pool of io_bdts - one for each bnx2fc_cmd */
297297
mem_size = num_ios * sizeof(struct io_bdt *);
298-
cmgr->io_bdt_pool = kmalloc(mem_size, GFP_KERNEL);
298+
cmgr->io_bdt_pool = kzalloc(mem_size, GFP_KERNEL);
299299
if (!cmgr->io_bdt_pool) {
300300
printk(KERN_ERR PFX "failed to alloc io_bdt_pool\n");
301301
goto mem_err;

drivers/scsi/libfc/fc_lport.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,14 +1726,14 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
17261726
fc_frame_payload_op(fp) != ELS_LS_ACC) {
17271727
FC_LPORT_DBG(lport, "FLOGI not accepted or bad response\n");
17281728
fc_lport_error(lport, fp);
1729-
goto err;
1729+
goto out;
17301730
}
17311731

17321732
flp = fc_frame_payload_get(fp, sizeof(*flp));
17331733
if (!flp) {
17341734
FC_LPORT_DBG(lport, "FLOGI bad response\n");
17351735
fc_lport_error(lport, fp);
1736-
goto err;
1736+
goto out;
17371737
}
17381738

17391739
mfs = ntohs(flp->fl_csp.sp_bb_data) &
@@ -1743,7 +1743,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
17431743
FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, "
17441744
"lport->mfs:%hu\n", mfs, lport->mfs);
17451745
fc_lport_error(lport, fp);
1746-
goto err;
1746+
goto out;
17471747
}
17481748

17491749
if (mfs <= lport->mfs) {

drivers/scsi/scsi_debug.c

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262

6363
/* make sure inq_product_rev string corresponds to this version */
6464
#define SDEBUG_VERSION "0188" /* format to fit INQUIRY revision field */
65-
static const char *sdebug_version_date = "20180128";
65+
static const char *sdebug_version_date = "20190125";
6666

6767
#define MY_NAME "scsi_debug"
6868

@@ -735,7 +735,7 @@ static inline bool scsi_debug_lbp(void)
735735
(sdebug_lbpu || sdebug_lbpws || sdebug_lbpws10);
736736
}
737737

738-
static void *fake_store(unsigned long long lba)
738+
static void *lba2fake_store(unsigned long long lba)
739739
{
740740
lba = do_div(lba, sdebug_store_sectors);
741741

@@ -2514,8 +2514,8 @@ static int do_device_access(struct scsi_cmnd *scmd, u32 sg_skip, u64 lba,
25142514
return ret;
25152515
}
25162516

2517-
/* If fake_store(lba,num) compares equal to arr(num), then copy top half of
2518-
* arr into fake_store(lba,num) and return true. If comparison fails then
2517+
/* If lba2fake_store(lba,num) compares equal to arr(num), then copy top half of
2518+
* arr into lba2fake_store(lba,num) and return true. If comparison fails then
25192519
* return false. */
25202520
static bool comp_write_worker(u64 lba, u32 num, const u8 *arr)
25212521
{
@@ -2643,7 +2643,7 @@ static int prot_verify_read(struct scsi_cmnd *SCpnt, sector_t start_sec,
26432643
if (sdt->app_tag == cpu_to_be16(0xffff))
26442644
continue;
26452645

2646-
ret = dif_verify(sdt, fake_store(sector), sector, ei_lba);
2646+
ret = dif_verify(sdt, lba2fake_store(sector), sector, ei_lba);
26472647
if (ret) {
26482648
dif_errors++;
26492649
return ret;
@@ -3261,10 +3261,12 @@ static int resp_write_scat(struct scsi_cmnd *scp,
32613261
static int resp_write_same(struct scsi_cmnd *scp, u64 lba, u32 num,
32623262
u32 ei_lba, bool unmap, bool ndob)
32633263
{
3264+
int ret;
32643265
unsigned long iflags;
32653266
unsigned long long i;
3266-
int ret;
3267-
u64 lba_off;
3267+
u32 lb_size = sdebug_sector_size;
3268+
u64 block, lbaa;
3269+
u8 *fs1p;
32683270

32693271
ret = check_device_access_params(scp, lba, num);
32703272
if (ret)
@@ -3276,31 +3278,30 @@ static int resp_write_same(struct scsi_cmnd *scp, u64 lba, u32 num,
32763278
unmap_region(lba, num);
32773279
goto out;
32783280
}
3279-
3280-
lba_off = lba * sdebug_sector_size;
3281+
lbaa = lba;
3282+
block = do_div(lbaa, sdebug_store_sectors);
32813283
/* if ndob then zero 1 logical block, else fetch 1 logical block */
3284+
fs1p = fake_storep + (block * lb_size);
32823285
if (ndob) {
3283-
memset(fake_storep + lba_off, 0, sdebug_sector_size);
3286+
memset(fs1p, 0, lb_size);
32843287
ret = 0;
32853288
} else
3286-
ret = fetch_to_dev_buffer(scp, fake_storep + lba_off,
3287-
sdebug_sector_size);
3289+
ret = fetch_to_dev_buffer(scp, fs1p, lb_size);
32883290

32893291
if (-1 == ret) {
32903292
write_unlock_irqrestore(&atomic_rw, iflags);
32913293
return DID_ERROR << 16;
3292-
} else if (sdebug_verbose && !ndob && (ret < sdebug_sector_size))
3294+
} else if (sdebug_verbose && !ndob && (ret < lb_size))
32933295
sdev_printk(KERN_INFO, scp->device,
32943296
"%s: %s: lb size=%u, IO sent=%d bytes\n",
3295-
my_name, "write same",
3296-
sdebug_sector_size, ret);
3297+
my_name, "write same", lb_size, ret);
32973298

32983299
/* Copy first sector to remaining blocks */
3299-
for (i = 1 ; i < num ; i++)
3300-
memcpy(fake_storep + ((lba + i) * sdebug_sector_size),
3301-
fake_storep + lba_off,
3302-
sdebug_sector_size);
3303-
3300+
for (i = 1 ; i < num ; i++) {
3301+
lbaa = lba + i;
3302+
block = do_div(lbaa, sdebug_store_sectors);
3303+
memmove(fake_storep + (block * lb_size), fs1p, lb_size);
3304+
}
33043305
if (scsi_debug_lbp())
33053306
map_region(lba, num);
33063307
out:

0 commit comments

Comments
 (0)