From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: Dan Carpenter <error27@gmail.com>
Cc: James Bottomley <James.Bottomley@suse.de>,
linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [patch] [SCSI] target: checking for NULL instead of IS_ERR
Date: Sat, 15 Jan 2011 20:52:24 +0000 [thread overview]
Message-ID: <1295124744.22813.8.camel@haakon2.linux-iscsi.org> (raw)
In-Reply-To: <20110115140300.GC2721@bicker>
On Sat, 2011-01-15 at 17:03 +0300, Dan Carpenter wrote:
> blkdev_get_by_path() returns an ERR_PTR() or error and it doesn't return
> a NULL. It looks like this bug would be easy to trigger by mistake.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
Good catch here Dan.. This was added after a linux-next build failure
over the holidays, but I completely missed the fact that it returns
ERR_PTR.. Thanks for spotting this one!
The same problem exists in target_core_pscsi.c:pscsi_create_type_disk()
as well.. Committed both fixes as 862ede4cbaf in
lio-core-2.6.git/linus-38-rc1 against the .38 mainline target merge, and
cherry picked into scsi-post-merge-2.6.git/for-jejb..
James, please make sure this fix is included in your next pull to Linus.
--nab
> diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
> index c6e0d75..3456135 100644
> --- a/drivers/target/target_core_iblock.c
> +++ b/drivers/target/target_core_iblock.c
> @@ -154,7 +154,7 @@ static struct se_device *iblock_create_virtdevice(
>
> bd = blkdev_get_by_path(ib_dev->ibd_udev_path,
> FMODE_WRITE|FMODE_READ|FMODE_EXCL, ib_dev);
> - if (!(bd))
> + if (IS_ERR(bd))
> goto failed;
> /*
> * Setup the local scope queue_limits from struct request_queue->limits
prev parent reply other threads:[~2011-01-15 20:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-15 14:03 [patch] [SCSI] target: checking for NULL instead of IS_ERR Dan Carpenter
2011-01-15 20:52 ` Nicholas A. Bellinger [this message]
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=1295124744.22813.8.camel@haakon2.linux-iscsi.org \
--to=nab@linux-iscsi.org \
--cc=James.Bottomley@suse.de \
--cc=error27@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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