]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Mike Christie <michaelc@cs.wisc.edu> |
2 | Date: Thu Mar 5 14:46:07 2009 -0600 | |
3 | X-Git: 728996829b3e2a3bbacb7390e6c040dd839cdf21 | |
4 | Subject: libiscsi: fix possbile null ptr session command cleanup | |
5 | References: bnc#498369 | |
6 | ||
7 | If the iscsi eh fires when the current task is a nop, then | |
8 | the task->sc pointer is null. fail_all_commands could | |
9 | then try to do task->sc->device and oops. We actually do | |
10 | not need to access the curr task in this path, because | |
11 | if it is a cmd task the fail_command call will handle | |
12 | this and if it is mgmt task then the flush of the mgmt | |
13 | queues will handle that. | |
14 | ||
15 | Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> | |
16 | Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> | |
17 | Signed-off-by: Hannes Reinecke <hare@suse.de> | |
18 | ||
19 | --- | |
20 | drivers/scsi/libiscsi.c | 7 +++++-- | |
21 | 1 file changed, 5 insertions(+), 2 deletions(-) | |
22 | ||
23 | --- a/drivers/scsi/libiscsi.c | |
24 | +++ b/drivers/scsi/libiscsi.c | |
25 | @@ -1498,8 +1498,11 @@ static void fail_all_commands(struct isc | |
26 | { | |
27 | struct iscsi_task *task, *tmp; | |
28 | ||
29 | - if (conn->task && (conn->task->sc->device->lun == lun || lun == -1)) | |
30 | - conn->task = NULL; | |
31 | + if (conn->task) { | |
32 | + if (lun == -1 || | |
33 | + (conn->task->sc && conn->task->sc->device->lun == lun)) | |
34 | + conn->task = NULL; | |
35 | + } | |
36 | ||
37 | /* flush pending */ | |
38 | list_for_each_entry_safe(task, tmp, &conn->xmitqueue, running) { |