diff mbox

Re: [PATCH 22/25] io-controller: Per io group bdi congestion interface

Message ID 4A5FC2CA.1040609@ds.jp.nec.com (mailing list archive)
State New, archived
Headers show

Commit Message

IKEDA, Munehiro July 17, 2009, 12:16 a.m. UTC
Hi,

Vivek Goyal wrote, on 07/02/2009 04:01 PM:
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 2035c20..79fe6a9 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -90,6 +90,27 @@ void blk_queue_congestion_threshold(struct request_queue *q)
>   	q->nr_congestion_off = nr;
>   }
> 
> +#ifdef CONFIG_GROUP_IOSCHED
> +int blk_queue_io_group_congested(struct backing_dev_info *bdi, int bdi_bits,
> +					struct page *page)
> +{
> +	int ret = 0;
> +	struct request_queue *q = bdi->unplug_io_data;
> +
> +	if (!q&&  !q->elevator)
> +		return bdi_congested(bdi, bdi_bits);

It causes NULL pointer dereference for brd etc.

Signed-off-by: Munehiro "Muuhh" Ikeda <m-ikeda@ds.jp.nec.com>
---
 block/blk-core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Vivek Goyal July 17, 2009, 1:52 p.m. UTC | #1
On Thu, Jul 16, 2009 at 08:16:10PM -0400, Munehiro Ikeda wrote:
> Hi,
> 
> Vivek Goyal wrote, on 07/02/2009 04:01 PM:
> > diff --git a/block/blk-core.c b/block/blk-core.c
> > index 2035c20..79fe6a9 100644
> > --- a/block/blk-core.c
> > +++ b/block/blk-core.c
> > @@ -90,6 +90,27 @@ void blk_queue_congestion_threshold(struct request_queue *q)
> >   	q->nr_congestion_off = nr;
> >   }
> > 
> > +#ifdef CONFIG_GROUP_IOSCHED
> > +int blk_queue_io_group_congested(struct backing_dev_info *bdi, int bdi_bits,
> > +					struct page *page)
> > +{
> > +	int ret = 0;
> > +	struct request_queue *q = bdi->unplug_io_data;
> > +
> > +	if (!q&&  !q->elevator)
> > +		return bdi_congested(bdi, bdi_bits);
> 
> It causes NULL pointer dereference for brd etc.
> 
> Signed-off-by: Munehiro "Muuhh" Ikeda <m-ikeda@ds.jp.nec.com>
> ---
>  block/blk-core.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 79fe6a9..39fab66 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -97,7 +97,7 @@ int blk_queue_io_group_congested(struct backing_dev_info *bdi, int bdi_bits,
>  	int ret = 0;
>  	struct request_queue *q = bdi->unplug_io_data;
>  
> -	if (!q && !q->elevator)
> +	if (!q || !q->elevator)
>  		return bdi_congested(bdi, bdi_bits);
>  

Hi,

Thanks for the patch. I also noticed this recently and fixed it for next
to be posted version.

Thanks
Vivek

>  	/* Do we need to hold queue lock? */
> -- 
> 1.6.2.5
> 
> 
> -- 
> IKEDA, Munehiro
>   NEC Corporation of America
>     m-ikeda@ds.jp.nec.com

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox

Patch

diff --git a/block/blk-core.c b/block/blk-core.c
index 79fe6a9..39fab66 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -97,7 +97,7 @@  int blk_queue_io_group_congested(struct backing_dev_info *bdi, int bdi_bits,
 	int ret = 0;
 	struct request_queue *q = bdi->unplug_io_data;
 
-	if (!q && !q->elevator)
+	if (!q || !q->elevator)
 		return bdi_congested(bdi, bdi_bits);
 
 	/* Do we need to hold queue lock? */