Skip to content

Commit 7e29f07

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: "One target driver fix and one scsi-generic one. The latter is 10 lines because the problem lock has to be dropped and re-taken around the call causing the sleep in atomic" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: sg: Do not sleep in atomic context scsi: target: tcm_loop: Fix segfault in tcm_loop_tpg_address_show()
2 parents ebd9754 + 90449f2 commit 7e29f07

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

drivers/scsi/sg.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2208,9 +2208,17 @@ sg_remove_sfp_usercontext(struct work_struct *work)
22082208
write_lock_irqsave(&sfp->rq_list_lock, iflags);
22092209
while (!list_empty(&sfp->rq_list)) {
22102210
srp = list_first_entry(&sfp->rq_list, Sg_request, entry);
2211-
sg_finish_rem_req(srp);
22122211
list_del(&srp->entry);
2212+
write_unlock_irqrestore(&sfp->rq_list_lock, iflags);
2213+
2214+
sg_finish_rem_req(srp);
2215+
/*
2216+
* sg_rq_end_io() uses srp->parentfp. Hence, only clear
2217+
* srp->parentfp after blk_mq_free_request() has been called.
2218+
*/
22132219
srp->parentfp = NULL;
2220+
2221+
write_lock_irqsave(&sfp->rq_list_lock, iflags);
22142222
}
22152223
write_unlock_irqrestore(&sfp->rq_list_lock, iflags);
22162224

drivers/target/loopback/tcm_loop.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,9 @@ static ssize_t tcm_loop_tpg_address_show(struct config_item *item,
894894
struct tcm_loop_tpg, tl_se_tpg);
895895
struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba;
896896

897+
if (!tl_hba->sh)
898+
return -ENODEV;
899+
897900
return snprintf(page, PAGE_SIZE, "%d:0:%d\n",
898901
tl_hba->sh->host_no, tl_tpg->tl_tpgt);
899902
}

0 commit comments

Comments
 (0)