mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-21 05:14:52 +08:00
SCSI fixes on 20210320
Eight fixes, all in drivers, all fairly minor either being fixes in error legs, memory leaks on teardown, context errors or semantic problems. Signed-off-by: James E.J. Bottomley <jejb@linux.ibm.com> -----BEGIN PGP SIGNATURE----- iJwEABMIAEQWIQTnYEDbdso9F2cI+arnQslM7pishQUCYFYmeiYcamFtZXMuYm90 dG9tbGV5QGhhbnNlbnBhcnRuZXJzaGlwLmNvbQAKCRDnQslM7pishXQRAPwKUNlT 7KbOMx5MqsBq+/0m7iVUHEDg0kNJwYslEL0jSQEAnauUYfDI34z6cPXx4L+hqOiM wP5dRGK4rs1u92AJmoY= =h42D -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
af97713dff
@ -5784,6 +5784,8 @@ static void ibmvfc_free_mem(struct ibmvfc_host *vhost)
|
||||
vhost->disc_buf_dma);
|
||||
dma_free_coherent(vhost->dev, sizeof(*vhost->login_buf),
|
||||
vhost->login_buf, vhost->login_buf_dma);
|
||||
dma_free_coherent(vhost->dev, sizeof(*vhost->channel_setup_buf),
|
||||
vhost->channel_setup_buf, vhost->channel_setup_dma);
|
||||
dma_pool_destroy(vhost->sg_pool);
|
||||
ibmvfc_free_queue(vhost, async_q);
|
||||
LEAVE;
|
||||
|
@ -2421,7 +2421,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
|
||||
memset(dstbuf, 0, 33);
|
||||
size = (nbytes < 32) ? nbytes : 32;
|
||||
if (copy_from_user(dstbuf, buf, size))
|
||||
return 0;
|
||||
return -EFAULT;
|
||||
|
||||
if (dent == phba->debug_InjErrLBA) {
|
||||
if ((dstbuf[0] == 'o') && (dstbuf[1] == 'f') &&
|
||||
@ -2430,7 +2430,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
|
||||
}
|
||||
|
||||
if ((tmp == 0) && (kstrtoull(dstbuf, 0, &tmp)))
|
||||
return 0;
|
||||
return -EINVAL;
|
||||
|
||||
if (dent == phba->debug_writeGuard)
|
||||
phba->lpfc_injerr_wgrd_cnt = (uint32_t)tmp;
|
||||
|
@ -413,7 +413,7 @@ mpt3sas_get_port_by_id(struct MPT3SAS_ADAPTER *ioc,
|
||||
* And add this object to port_table_list.
|
||||
*/
|
||||
if (!ioc->multipath_on_hba) {
|
||||
port = kzalloc(sizeof(struct hba_port), GFP_KERNEL);
|
||||
port = kzalloc(sizeof(struct hba_port), GFP_ATOMIC);
|
||||
if (!port)
|
||||
return NULL;
|
||||
|
||||
|
@ -2273,12 +2273,12 @@ static void myrs_cleanup(struct myrs_hba *cs)
|
||||
if (cs->mmio_base) {
|
||||
cs->disable_intr(cs);
|
||||
iounmap(cs->mmio_base);
|
||||
cs->mmio_base = NULL;
|
||||
}
|
||||
if (cs->irq)
|
||||
free_irq(cs->irq, cs);
|
||||
if (cs->io_addr)
|
||||
release_region(cs->io_addr, 0x80);
|
||||
iounmap(cs->mmio_base);
|
||||
pci_set_drvdata(pdev, NULL);
|
||||
pci_disable_device(pdev);
|
||||
scsi_host_put(cs->host);
|
||||
|
@ -116,7 +116,6 @@
|
||||
(min(1270, ((ql) > 0) ? (QLA_TGT_DATASEGS_PER_CMD_24XX + \
|
||||
QLA_TGT_DATASEGS_PER_CONT_24XX*((ql) - 1)) : 0))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define GET_TARGET_ID(ha, iocb) ((HAS_EXTENDED_IDS(ha)) \
|
||||
? le16_to_cpu((iocb)->u.isp2x.target.extended) \
|
||||
@ -244,6 +243,7 @@ struct ctio_to_2xxx {
|
||||
#ifndef CTIO_RET_TYPE
|
||||
#define CTIO_RET_TYPE 0x17 /* CTIO return entry */
|
||||
#define ATIO_TYPE7 0x06 /* Accept target I/O entry for 24xx */
|
||||
#endif
|
||||
|
||||
struct fcp_hdr {
|
||||
uint8_t r_ctl;
|
||||
|
@ -280,27 +280,28 @@ static int sd_zbc_update_wp_offset_cb(struct blk_zone *zone, unsigned int idx,
|
||||
static void sd_zbc_update_wp_offset_workfn(struct work_struct *work)
|
||||
{
|
||||
struct scsi_disk *sdkp;
|
||||
unsigned long flags;
|
||||
unsigned int zno;
|
||||
int ret;
|
||||
|
||||
sdkp = container_of(work, struct scsi_disk, zone_wp_offset_work);
|
||||
|
||||
spin_lock_bh(&sdkp->zones_wp_offset_lock);
|
||||
spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags);
|
||||
for (zno = 0; zno < sdkp->nr_zones; zno++) {
|
||||
if (sdkp->zones_wp_offset[zno] != SD_ZBC_UPDATING_WP_OFST)
|
||||
continue;
|
||||
|
||||
spin_unlock_bh(&sdkp->zones_wp_offset_lock);
|
||||
spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags);
|
||||
ret = sd_zbc_do_report_zones(sdkp, sdkp->zone_wp_update_buf,
|
||||
SD_BUF_SIZE,
|
||||
zno * sdkp->zone_blocks, true);
|
||||
spin_lock_bh(&sdkp->zones_wp_offset_lock);
|
||||
spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags);
|
||||
if (!ret)
|
||||
sd_zbc_parse_report(sdkp, sdkp->zone_wp_update_buf + 64,
|
||||
zno, sd_zbc_update_wp_offset_cb,
|
||||
sdkp);
|
||||
}
|
||||
spin_unlock_bh(&sdkp->zones_wp_offset_lock);
|
||||
spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags);
|
||||
|
||||
scsi_device_put(sdkp->device);
|
||||
}
|
||||
@ -324,6 +325,7 @@ blk_status_t sd_zbc_prepare_zone_append(struct scsi_cmnd *cmd, sector_t *lba,
|
||||
struct request *rq = cmd->request;
|
||||
struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
|
||||
unsigned int wp_offset, zno = blk_rq_zone_no(rq);
|
||||
unsigned long flags;
|
||||
blk_status_t ret;
|
||||
|
||||
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,
|
||||
if (!blk_req_zone_write_trylock(rq))
|
||||
return BLK_STS_ZONE_RESOURCE;
|
||||
|
||||
spin_lock_bh(&sdkp->zones_wp_offset_lock);
|
||||
spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags);
|
||||
wp_offset = sdkp->zones_wp_offset[zno];
|
||||
switch (wp_offset) {
|
||||
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,
|
||||
|
||||
*lba += wp_offset;
|
||||
}
|
||||
spin_unlock_bh(&sdkp->zones_wp_offset_lock);
|
||||
spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags);
|
||||
if (ret)
|
||||
blk_req_zone_write_unlock(rq);
|
||||
return ret;
|
||||
@ -445,6 +447,7 @@ static unsigned int sd_zbc_zone_wp_update(struct scsi_cmnd *cmd,
|
||||
struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
|
||||
unsigned int zno = blk_rq_zone_no(rq);
|
||||
enum req_opf op = req_op(rq);
|
||||
unsigned long flags;
|
||||
|
||||
/*
|
||||
* If we got an error for a command that needs updating the write
|
||||
@ -452,7 +455,7 @@ static unsigned int sd_zbc_zone_wp_update(struct scsi_cmnd *cmd,
|
||||
* invalid to force an update from disk the next time a zone append
|
||||
* command is issued.
|
||||
*/
|
||||
spin_lock_bh(&sdkp->zones_wp_offset_lock);
|
||||
spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags);
|
||||
|
||||
if (result && op != REQ_OP_ZONE_RESET_ALL) {
|
||||
if (op == REQ_OP_ZONE_APPEND) {
|
||||
@ -496,7 +499,7 @@ static unsigned int sd_zbc_zone_wp_update(struct scsi_cmnd *cmd,
|
||||
}
|
||||
|
||||
unlock_wp_offset:
|
||||
spin_unlock_bh(&sdkp->zones_wp_offset_lock);
|
||||
spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags);
|
||||
|
||||
return good_bytes;
|
||||
}
|
||||
|
@ -1269,8 +1269,8 @@ static int st_open(struct inode *inode, struct file *filp)
|
||||
spin_lock(&st_use_lock);
|
||||
if (STp->in_use) {
|
||||
spin_unlock(&st_use_lock);
|
||||
scsi_tape_put(STp);
|
||||
DEBC_printk(STp, "Device already in use.\n");
|
||||
scsi_tape_put(STp);
|
||||
return (-EBUSY);
|
||||
}
|
||||
|
||||
|
@ -911,7 +911,7 @@ static void ufs_mtk_vreg_set_lpm(struct ufs_hba *hba, bool lpm)
|
||||
if (!hba->vreg_info.vccq2 || !hba->vreg_info.vcc)
|
||||
return;
|
||||
|
||||
if (lpm & !hba->vreg_info.vcc->enabled)
|
||||
if (lpm && !hba->vreg_info.vcc->enabled)
|
||||
regulator_set_mode(hba->vreg_info.vccq2->reg,
|
||||
REGULATOR_MODE_IDLE);
|
||||
else if (!lpm)
|
||||
|
Loading…
Reference in New Issue
Block a user