linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matias Bjorling <m@bjorling.me>
To: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Jens Axboe <axboe@kernel.dk>,
	Andrew Morton <akpm@linux-foundation.org>,
	Yuanhan Liu <yuanhan.liu@linux.intel.com>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	Jan Kara <jack@suse.cz>, Johannes Weiner <hannes@cmpxchg.org>,
	Zhang Yanfei <zhangyanfei@cn.fujitsu.com>,
	Jeff <jmoyer@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Sumanth <sumantk2@linux.vnet.ibm.com>
Subject: Re: [RFC PATCH V3 1/2]  null_blk: Null pointer deference problem in alloc_page_buffers
Date: Tue, 21 Jan 2014 09:13:03 -0800	[thread overview]
Message-ID: <52DEAA9F.7010304@bjorling.me> (raw)
In-Reply-To: <1390303800-22422-2-git-send-email-raghavendra.kt@linux.vnet.ibm.com>

On 01/21/2014 03:29 AM, Raghavendra K T wrote:
>  If we load the null_blk module with bs=8k we get following oops:
> [ 3819.812190] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
> [ 3819.812387] IP: [<ffffffff81170aa5>] create_empty_buffers+0x28/0xaf
> [ 3819.812527] PGD 219244067 PUD 215a06067 PMD 0
> [ 3819.812640] Oops: 0000 [#1] SMP
> [ 3819.812772] Modules linked in: null_blk(+)
> 
>  Fix that by resetting block size to PAGE_SIZE if it is greater than PAGE_SIZE
> 
> Reported-by: Sumanth <sumantk2@linux.vnet.ibm.com>
> Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
> ---
>  drivers/block/null_blk.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
> index a2e69d2..a01d7f6 100644
> --- a/drivers/block/null_blk.c
> +++ b/drivers/block/null_blk.c
> @@ -622,6 +622,11 @@ static int __init null_init(void)
>  		irqmode = NULL_IRQ_NONE;
>  	}
>  #endif
> +	if (bs > PAGE_SIZE) {
> +		pr_warn("null_blk: invalid block size\n");
> +		pr_warn("null_blk: defaults block size to %lu\n", PAGE_SIZE);
> +		bs = PAGE_SIZE;
> +	}
>  
>  	if (queue_mode == NULL_Q_MQ && use_per_node_hctx) {
>  		if (submit_queues < nr_online_nodes) {
> 

Reviewed-by: Matias Bjorling <m@bjorling.me>

  reply	other threads:[~2014-01-21 17:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-21 11:29 [RFC PATCH V3 0/2] Fix null pointer deference problem Raghavendra K T
2014-01-21 11:29 ` [RFC PATCH V3 1/2] null_blk: Null pointer deference problem in alloc_page_buffers Raghavendra K T
2014-01-21 17:13   ` Matias Bjorling [this message]
2014-01-22  4:22   ` Jens Axboe
2014-01-21 11:30 ` [RFC PATCH V3 2/2] fs : Add sanity checks for block size > PAGE_SIZE Raghavendra K T
2014-01-21 17:13   ` Matias Bjorling
2014-01-21 20:21   ` Andrew Morton
2014-01-22  6:52     ` Raghavendra K T

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=52DEAA9F.7010304@bjorling.me \
    --to=m@bjorling.me \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=darrick.wong@oracle.com \
    --cc=hannes@cmpxchg.org \
    --cc=jack@suse.cz \
    --cc=jmoyer@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=raghavendra.kt@linux.vnet.ibm.com \
    --cc=sumantk2@linux.vnet.ibm.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yuanhan.liu@linux.intel.com \
    --cc=zhangyanfei@cn.fujitsu.com \
    /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;
as well as URLs for NNTP newsgroup(s).