From: michaelc@cs.wisc.edu
To: linux-scsi@vger.kernel.org
Cc: Jean Delvare <jdelvare@suse.de>, Mike Christie <michaelc@cs.wisc.edu>
Subject: [PATCH 7/7] libiscsi: fix iscsi pool error path
Date: Wed, 1 Apr 2009 13:11:29 -0500 [thread overview]
Message-ID: <12386094933319-git-send-email-michaelc@cs.wisc.edu> (raw)
In-Reply-To: <12386094922477-git-send-email-michaelc@cs.wisc.edu>
From: Jean Delvare <jdelvare@suse.de>
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>
---
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 dfaa8ad..6896283 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)
q->queue = kfifo_init((void*)q->pool, max * sizeof(void*),
GFP_KERNEL, NULL);
- if (q->queue == ERR_PTR(-ENOMEM))
+ if (IS_ERR(q->queue)) {
+ q->queue = NULL;
goto enomem;
+ }
for (i = 0; i < max; i++) {
q->pool[i] = kzalloc(item_size, GFP_KERNEL);
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-04-01 18:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-01 18:11 iscsi bugfixes and cleanups michaelc
2009-04-01 18:11 ` [PATCH 1/7] cxgb3i - subscribe to error notification from cxgb3 driver michaelc
2009-04-01 18:11 ` [PATCH 2/7] cxgb3i - re-initialize ddp settings after chip reset michaelc
2009-04-01 18:11 ` [PATCH 3/7] cxgb3i - re-read ddp settings information " michaelc
2009-04-01 18:11 ` [PATCH 4/7] cxgb3i - close all tcp connections upon " michaelc
2009-04-01 18:11 ` [PATCH 5/7] cxgb3i -- merge cxgb3i_ddp into cxgb3i module michaelc
2009-04-01 18:11 ` [PATCH 6/7] cxgb3i: call ddp release function directly michaelc
2009-04-01 18:11 ` michaelc [this message]
2009-04-02 14:02 ` [PATCH 7/7] libiscsi: fix iscsi pool error path Jean Delvare
2009-04-02 15:15 ` Mike Christie
2009-04-02 15:27 ` Chris Wright
2009-04-02 16:05 ` Mike Christie
2009-04-02 17:26 ` Chris Wright
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=12386094933319-git-send-email-michaelc@cs.wisc.edu \
--to=michaelc@cs.wisc.edu \
--cc=jdelvare@suse.de \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox