All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] block: NULL dereference on error path in __blkdev_get()
@ 2011-03-13 20:59 ` Dan Carpenter
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2011-03-13 20:59 UTC (permalink / raw)
  To: Alexander Viro, tj; +Cc: linux-fsdevel, kernel-janitors

"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>

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] 9+ messages in thread

* [patch] block: NULL dereference on error path in __blkdev_get()
@ 2011-03-13 20:59 ` Dan Carpenter
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2011-03-13 20:59 UTC (permalink / raw)
  To: Alexander Viro, tj; +Cc: linux-fsdevel, kernel-janitors

"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>

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] 9+ messages in thread

* Re: [patch] block: NULL dereference on error path in __blkdev_get()
  2011-03-13 20:59 ` Dan Carpenter
@ 2011-03-14  8:58   ` Tejun Heo
  -1 siblings, 0 replies; 9+ messages in thread
From: Tejun Heo @ 2011-03-14  8:58 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Alexander Viro, linux-fsdevel, kernel-janitors

Hello,

On Sun, Mar 13, 2011 at 11:59:37PM +0300, Dan Carpenter wrote:
> "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>

Sorry about the trouble.  I hate that function.  :-(

-- 
tejun

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] block: NULL dereference on error path in __blkdev_get()
@ 2011-03-14  8:58   ` Tejun Heo
  0 siblings, 0 replies; 9+ messages in thread
From: Tejun Heo @ 2011-03-14  8:58 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Alexander Viro, linux-fsdevel, kernel-janitors

Hello,

On Sun, Mar 13, 2011 at 11:59:37PM +0300, Dan Carpenter wrote:
> "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>

Sorry about the trouble.  I hate that function.  :-(

-- 
tejun

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] block: NULL dereference on error path in __blkdev_get()
  2011-03-14  8:58   ` Tejun Heo
@ 2011-03-18  8:32     ` Tejun Heo
  -1 siblings, 0 replies; 9+ messages in thread
From: Tejun Heo @ 2011-03-18  8:32 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Alexander Viro, linux-fsdevel, kernel-janitors

On Mon, Mar 14, 2011 at 09:58:19AM +0100, Tejun Heo wrote:
> Hello,
> 
> On Sun, Mar 13, 2011 at 11:59:37PM +0300, Dan Carpenter wrote:
> > "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>
> 
> Sorry about the trouble.  I hate that function.  :-(

I thought Jens was cc'd.  I'll forward the patch to him & LKML.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] block: NULL dereference on error path in __blkdev_get()
@ 2011-03-18  8:32     ` Tejun Heo
  0 siblings, 0 replies; 9+ messages in thread
From: Tejun Heo @ 2011-03-18  8:32 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Alexander Viro, linux-fsdevel, kernel-janitors

On Mon, Mar 14, 2011 at 09:58:19AM +0100, Tejun Heo wrote:
> Hello,
> 
> On Sun, Mar 13, 2011 at 11:59:37PM +0300, Dan Carpenter wrote:
> > "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>
> 
> Sorry about the trouble.  I hate that function.  :-(

I thought Jens was cc'd.  I'll forward the patch to him & LKML.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [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; 9+ 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] 9+ messages in thread

* Re: [PATCH] block: NULL dereference on error path in __blkdev_get()
  2011-03-18  8:37 [PATCH] " Tejun Heo
@ 2011-03-18 22:26 ` Justin TerAvest
  2011-03-19 12:54 ` Jens Axboe
  1 sibling, 0 replies; 9+ 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] 9+ messages in thread

* Re: [PATCH] block: NULL dereference on error path in __blkdev_get()
  2011-03-18  8:37 [PATCH] " Tejun Heo
  2011-03-18 22:26 ` Justin TerAvest
@ 2011-03-19 12:54 ` Jens Axboe
  1 sibling, 0 replies; 9+ 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] 9+ messages in thread

end of thread, other threads:[~2011-03-19 12:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-13 20:59 [patch] block: NULL dereference on error path in __blkdev_get() Dan Carpenter
2011-03-13 20:59 ` Dan Carpenter
2011-03-14  8:58 ` Tejun Heo
2011-03-14  8:58   ` Tejun Heo
2011-03-18  8:32   ` Tejun Heo
2011-03-18  8:32     ` Tejun Heo
  -- strict thread matches above, loose matches on Subject: below --
2011-03-18  8:37 [PATCH] " Tejun Heo
2011-03-18 22:26 ` Justin TerAvest
2011-03-19 12:54 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.