]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.25/patches.fixes/libiscsi-fix-null-pointer-in-fail-all-commands
Changed checkfs to auto reboot after correctable fsck fixes.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.fixes / libiscsi-fix-null-pointer-in-fail-all-commands
CommitLineData
00e5a55c
BS
1From: Mike Christie <michaelc@cs.wisc.edu>
2Date: Thu Mar 5 14:46:07 2009 -0600
3X-Git: 728996829b3e2a3bbacb7390e6c040dd839cdf21
4Subject: libiscsi: fix possbile null ptr session command cleanup
5References: bnc#498369
6
7If the iscsi eh fires when the current task is a nop, then
8the task->sc pointer is null. fail_all_commands could
9then try to do task->sc->device and oops. We actually do
10not need to access the curr task in this path, because
11if it is a cmd task the fail_command call will handle
12this and if it is mgmt task then the flush of the mgmt
13queues will handle that.
14
15Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
16Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
17Signed-off-by: Hannes Reinecke <hare@suse.de>
18
19diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
20index d070179..dfaa8ad 100644
21--- a/drivers/scsi/libiscsi.c
22+++ b/drivers/scsi/libiscsi.c
23@@ -1603,8 +1603,11 @@ static void fail_all_commands(struct iscsi_conn *conn, unsigned lun,
24 {
25 struct iscsi_task *task, *tmp;
26
27- if (conn->task && (conn->task->sc->device->lun == lun || lun == -1))
28- conn->task = NULL;
29+ if (conn->task) {
30+ if (lun == -1 ||
31+ (conn->task->sc && conn->task->sc->device->lun == lun))
32+ conn->task = NULL;
33+ }
34
35 /* flush pending */
36 list_for_each_entry_safe(task, tmp, &conn->xmitqueue, running) {