* [PATCH] block: NULL dereference on error path in __blkdev_get()
@ 2011-03-18 8:37 Tejun Heo
2011-03-18 22:26 ` Justin TerAvest
2011-03-19 12:54 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: Tejun Heo @ 2011-03-18 8:37 UTC (permalink / raw)
To: Jens Axboe, linux-kernel
From: Dan Carpenter <error27@gmail.com>
"disk" is always NULL when we goto out. There was a check for this
before, but it was removed in 69e02c59a7d9 "block: Don't check events
while open is in progress".
Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
diff --git a/fs/block_dev.c b/fs/block_dev.c
index fbe05cb..7d02afb 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1181,9 +1181,9 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
out_unlock_bdev:
mutex_unlock(&bdev->bd_mutex);
disk_unblock_events(disk);
- out:
module_put(disk->fops->owner);
put_disk(disk);
+ out:
bdput(bdev);
return ret;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] block: NULL dereference on error path in __blkdev_get()
2011-03-18 8:37 [PATCH] block: NULL dereference on error path in __blkdev_get() Tejun Heo
@ 2011-03-18 22:26 ` Justin TerAvest
2011-03-19 12:54 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Justin TerAvest @ 2011-03-18 22:26 UTC (permalink / raw)
To: Tejun Heo; +Cc: Jens Axboe, linux-kernel
On Fri, Mar 18, 2011 at 1:37 AM, Tejun Heo <tj@kernel.org> wrote:
> From: Dan Carpenter <error27@gmail.com>
>
> "disk" is always NULL when we goto out. There was a check for this
> before, but it was removed in 69e02c59a7d9 "block: Don't check events
> while open is in progress".
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> Acked-by: Tejun Heo <tj@kernel.org>
I was running into this problem too; this patch fixes the problem.
Tested-by: Justin TerAvest <teravest@google.com>
>
> diff --git a/fs/block_dev.c b/fs/block_dev.c
> index fbe05cb..7d02afb 100644
> --- a/fs/block_dev.c
> +++ b/fs/block_dev.c
> @@ -1181,9 +1181,9 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
> out_unlock_bdev:
> mutex_unlock(&bdev->bd_mutex);
> disk_unblock_events(disk);
> - out:
> module_put(disk->fops->owner);
> put_disk(disk);
> + out:
> bdput(bdev);
>
> return ret;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] block: NULL dereference on error path in __blkdev_get()
2011-03-18 8:37 [PATCH] block: NULL dereference on error path in __blkdev_get() Tejun Heo
2011-03-18 22:26 ` Justin TerAvest
@ 2011-03-19 12:54 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2011-03-19 12:54 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-kernel
On 2011-03-18 09:37, Tejun Heo wrote:
> From: Dan Carpenter <error27@gmail.com>
>
> "disk" is always NULL when we goto out. There was a check for this
> before, but it was removed in 69e02c59a7d9 "block: Don't check events
> while open is in progress".
Thanks, applied.
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-03-19 12:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-18 8:37 [PATCH] block: NULL dereference on error path in __blkdev_get() Tejun Heo
2011-03-18 22:26 ` Justin TerAvest
2011-03-19 12:54 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).