Skip to content

Commit af97713

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: "Eight fixes, all in drivers, all fairly minor either being fixes in error legs, memory leaks on teardown, context errors or semantic problems" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: mpt3sas: Do not use GFP_KERNEL in atomic context scsi: ufs: ufs-mediatek: Correct operator & -> && scsi: sd_zbc: Update write pointer offset cache scsi: lpfc: Fix some error codes in debugfs scsi: qla2xxx: Fix broken #endif placement scsi: st: Fix a use after free in st_open() scsi: myrs: Fix a double free in myrs_cleanup() scsi: ibmvfc: Free channel_setup_buf during device tear down
2 parents 1c273e1 + a50bd64 commit af97713

File tree

8 files changed

+20
-15
lines changed

8 files changed

+20
-15
lines changed

drivers/scsi/ibmvscsi/ibmvfc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5784,6 +5784,8 @@ static void ibmvfc_free_mem(struct ibmvfc_host *vhost)
57845784
vhost->disc_buf_dma);
57855785
dma_free_coherent(vhost->dev, sizeof(*vhost->login_buf),
57865786
vhost->login_buf, vhost->login_buf_dma);
5787+
dma_free_coherent(vhost->dev, sizeof(*vhost->channel_setup_buf),
5788+
vhost->channel_setup_buf, vhost->channel_setup_dma);
57875789
dma_pool_destroy(vhost->sg_pool);
57885790
ibmvfc_free_queue(vhost, async_q);
57895791
LEAVE;

drivers/scsi/lpfc/lpfc_debugfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2421,7 +2421,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
24212421
memset(dstbuf, 0, 33);
24222422
size = (nbytes < 32) ? nbytes : 32;
24232423
if (copy_from_user(dstbuf, buf, size))
2424-
return 0;
2424+
return -EFAULT;
24252425

24262426
if (dent == phba->debug_InjErrLBA) {
24272427
if ((dstbuf[0] == 'o') && (dstbuf[1] == 'f') &&
@@ -2430,7 +2430,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
24302430
}
24312431

24322432
if ((tmp == 0) && (kstrtoull(dstbuf, 0, &tmp)))
2433-
return 0;
2433+
return -EINVAL;
24342434

24352435
if (dent == phba->debug_writeGuard)
24362436
phba->lpfc_injerr_wgrd_cnt = (uint32_t)tmp;

drivers/scsi/mpt3sas/mpt3sas_scsih.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ mpt3sas_get_port_by_id(struct MPT3SAS_ADAPTER *ioc,
413413
* And add this object to port_table_list.
414414
*/
415415
if (!ioc->multipath_on_hba) {
416-
port = kzalloc(sizeof(struct hba_port), GFP_KERNEL);
416+
port = kzalloc(sizeof(struct hba_port), GFP_ATOMIC);
417417
if (!port)
418418
return NULL;
419419

drivers/scsi/myrs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2273,12 +2273,12 @@ static void myrs_cleanup(struct myrs_hba *cs)
22732273
if (cs->mmio_base) {
22742274
cs->disable_intr(cs);
22752275
iounmap(cs->mmio_base);
2276+
cs->mmio_base = NULL;
22762277
}
22772278
if (cs->irq)
22782279
free_irq(cs->irq, cs);
22792280
if (cs->io_addr)
22802281
release_region(cs->io_addr, 0x80);
2281-
iounmap(cs->mmio_base);
22822282
pci_set_drvdata(pdev, NULL);
22832283
pci_disable_device(pdev);
22842284
scsi_host_put(cs->host);

drivers/scsi/qla2xxx/qla_target.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@
116116
(min(1270, ((ql) > 0) ? (QLA_TGT_DATASEGS_PER_CMD_24XX + \
117117
QLA_TGT_DATASEGS_PER_CONT_24XX*((ql) - 1)) : 0))
118118
#endif
119-
#endif
120119

121120
#define GET_TARGET_ID(ha, iocb) ((HAS_EXTENDED_IDS(ha)) \
122121
? le16_to_cpu((iocb)->u.isp2x.target.extended) \
@@ -244,6 +243,7 @@ struct ctio_to_2xxx {
244243
#ifndef CTIO_RET_TYPE
245244
#define CTIO_RET_TYPE 0x17 /* CTIO return entry */
246245
#define ATIO_TYPE7 0x06 /* Accept target I/O entry for 24xx */
246+
#endif
247247

248248
struct fcp_hdr {
249249
uint8_t r_ctl;

drivers/scsi/sd_zbc.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -280,27 +280,28 @@ static int sd_zbc_update_wp_offset_cb(struct blk_zone *zone, unsigned int idx,
280280
static void sd_zbc_update_wp_offset_workfn(struct work_struct *work)
281281
{
282282
struct scsi_disk *sdkp;
283+
unsigned long flags;
283284
unsigned int zno;
284285
int ret;
285286

286287
sdkp = container_of(work, struct scsi_disk, zone_wp_offset_work);
287288

288-
spin_lock_bh(&sdkp->zones_wp_offset_lock);
289+
spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags);
289290
for (zno = 0; zno < sdkp->nr_zones; zno++) {
290291
if (sdkp->zones_wp_offset[zno] != SD_ZBC_UPDATING_WP_OFST)
291292
continue;
292293

293-
spin_unlock_bh(&sdkp->zones_wp_offset_lock);
294+
spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags);
294295
ret = sd_zbc_do_report_zones(sdkp, sdkp->zone_wp_update_buf,
295296
SD_BUF_SIZE,
296297
zno * sdkp->zone_blocks, true);
297-
spin_lock_bh(&sdkp->zones_wp_offset_lock);
298+
spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags);
298299
if (!ret)
299300
sd_zbc_parse_report(sdkp, sdkp->zone_wp_update_buf + 64,
300301
zno, sd_zbc_update_wp_offset_cb,
301302
sdkp);
302303
}
303-
spin_unlock_bh(&sdkp->zones_wp_offset_lock);
304+
spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags);
304305

305306
scsi_device_put(sdkp->device);
306307
}
@@ -324,6 +325,7 @@ blk_status_t sd_zbc_prepare_zone_append(struct scsi_cmnd *cmd, sector_t *lba,
324325
struct request *rq = cmd->request;
325326
struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
326327
unsigned int wp_offset, zno = blk_rq_zone_no(rq);
328+
unsigned long flags;
327329
blk_status_t ret;
328330

329331
ret = sd_zbc_cmnd_checks(cmd);
@@ -337,7 +339,7 @@ blk_status_t sd_zbc_prepare_zone_append(struct scsi_cmnd *cmd, sector_t *lba,
337339
if (!blk_req_zone_write_trylock(rq))
338340
return BLK_STS_ZONE_RESOURCE;
339341

340-
spin_lock_bh(&sdkp->zones_wp_offset_lock);
342+
spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags);
341343
wp_offset = sdkp->zones_wp_offset[zno];
342344
switch (wp_offset) {
343345
case SD_ZBC_INVALID_WP_OFST:
@@ -366,7 +368,7 @@ blk_status_t sd_zbc_prepare_zone_append(struct scsi_cmnd *cmd, sector_t *lba,
366368

367369
*lba += wp_offset;
368370
}
369-
spin_unlock_bh(&sdkp->zones_wp_offset_lock);
371+
spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags);
370372
if (ret)
371373
blk_req_zone_write_unlock(rq);
372374
return ret;
@@ -445,14 +447,15 @@ static unsigned int sd_zbc_zone_wp_update(struct scsi_cmnd *cmd,
445447
struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
446448
unsigned int zno = blk_rq_zone_no(rq);
447449
enum req_opf op = req_op(rq);
450+
unsigned long flags;
448451

449452
/*
450453
* If we got an error for a command that needs updating the write
451454
* pointer offset cache, we must mark the zone wp offset entry as
452455
* invalid to force an update from disk the next time a zone append
453456
* command is issued.
454457
*/
455-
spin_lock_bh(&sdkp->zones_wp_offset_lock);
458+
spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags);
456459

457460
if (result && op != REQ_OP_ZONE_RESET_ALL) {
458461
if (op == REQ_OP_ZONE_APPEND) {
@@ -496,7 +499,7 @@ static unsigned int sd_zbc_zone_wp_update(struct scsi_cmnd *cmd,
496499
}
497500

498501
unlock_wp_offset:
499-
spin_unlock_bh(&sdkp->zones_wp_offset_lock);
502+
spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags);
500503

501504
return good_bytes;
502505
}

drivers/scsi/st.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1269,8 +1269,8 @@ static int st_open(struct inode *inode, struct file *filp)
12691269
spin_lock(&st_use_lock);
12701270
if (STp->in_use) {
12711271
spin_unlock(&st_use_lock);
1272-
scsi_tape_put(STp);
12731272
DEBC_printk(STp, "Device already in use.\n");
1273+
scsi_tape_put(STp);
12741274
return (-EBUSY);
12751275
}
12761276

drivers/scsi/ufs/ufs-mediatek.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ static void ufs_mtk_vreg_set_lpm(struct ufs_hba *hba, bool lpm)
911911
if (!hba->vreg_info.vccq2 || !hba->vreg_info.vcc)
912912
return;
913913

914-
if (lpm & !hba->vreg_info.vcc->enabled)
914+
if (lpm && !hba->vreg_info.vcc->enabled)
915915
regulator_set_mode(hba->vreg_info.vccq2->reg,
916916
REGULATOR_MODE_IDLE);
917917
else if (!lpm)

0 commit comments

Comments
 (0)