diff options
author | Jean Delvare <jdelvare@suse.de> | 2009-04-01 14:11:29 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-04-03 10:23:14 -0400 |
commit | fd6e1c14b73dbab89cb76af895d5612e4a8b5522 (patch) | |
tree | d1a11b7f5e46881dd01c6203f31cc36a2e266151 /drivers/scsi | |
parent | 5b2639d59afe0a30e1b955b23c52ee9099888058 (diff) |
[SCSI] libiscsi: fix iscsi pool error path
Le lundi 30 mars 2009, Chris Wright a écrit :
> q->queue could be ERR_PTR(-ENOMEM) which will break unwinding
> on error. Make iscsi_pool_free more defensive.
>
Making the freeing of q->queue dependent on q->pool being set looks
really weird (although it is correct at the moment. But this seems
to be fixable in a much simpler way.
With the benefit that only the error case is slowed down. In both
cases we have a problem if q->queue contains an error value but it's
not -ENOMEM. Apparently this can't happen today, but it doesn't feel
right to assume this will always be true. Maybe it's the right time
to fix this as well.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/libiscsi.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index dfaa8adf099e..689628359169 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -1999,8 +1999,10 @@ iscsi_pool_init(struct iscsi_pool *q, int max, void ***items, int item_size) | |||
1999 | 1999 | ||
2000 | q->queue = kfifo_init((void*)q->pool, max * sizeof(void*), | 2000 | q->queue = kfifo_init((void*)q->pool, max * sizeof(void*), |
2001 | GFP_KERNEL, NULL); | 2001 | GFP_KERNEL, NULL); |
2002 | if (q->queue == ERR_PTR(-ENOMEM)) | 2002 | if (IS_ERR(q->queue)) { |
2003 | q->queue = NULL; | ||
2003 | goto enomem; | 2004 | goto enomem; |
2005 | } | ||
2004 | 2006 | ||
2005 | for (i = 0; i < max; i++) { | 2007 | for (i = 0; i < max; i++) { |
2006 | q->pool[i] = kzalloc(item_size, GFP_KERNEL); | 2008 | q->pool[i] = kzalloc(item_size, GFP_KERNEL); |