Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1328346

Re: [REGRESSION] mm: filemap_map_pages NULL pointer dereference

Path csiph.com!au2pb.net!news.freedyn.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod
From Jeremiah Mahler <jmmahler@gmail.com>
Newsgroups linux.kernel
Subject Re: [REGRESSION] mm: filemap_map_pages NULL pointer dereference
Date Sat, 06 Feb 2016 19:20:01 +0100
Message-ID <qZfCF-2F1-5@gated-at.bofh.it> (permalink)
References <qYSZt-3G7-13@gated-at.bofh.it> <qYWTn-6c8-7@gated-at.bofh.it>
X-Original-To Andrew Morton <akpm@linux-foundation.org>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=hdtNdE3nwWwlpYtF5PEx1HOTb9WmaSLuCIIW5MHr8oc=; b=NfFfMKf1jb76aElD1HPxGl86yPUMlbdhonsqNFocG7sKwoh3L8yquSDRpKhSLaZHWg /0cTiFtbTw1O1TshgjonKRca0661IUTqPRYZsOgl9j6Sy86lGCE7riaodXoaN1B3a1GK rncdejtzFECDPoZS2cZMw+m3yG2gM+/SrMDzZtM9GFx/K4ux45idNsCCLbYYdPpa5vhR iWmYZgULBrn2rjdDhuWCeJwIEHjC5d0ae+Qw9RIXwjD4lXIgNplvblZ/wSNbkIJdtt82 YFTEZ8PYHDZlaIW0XL7VB1F1Qg0sAc8FmI7l05itUW4qu70KguyCUeesb+NEEhu0kn9N NUWg==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=hdtNdE3nwWwlpYtF5PEx1HOTb9WmaSLuCIIW5MHr8oc=; b=GgHCX+bzUYEwniA53nbuU2V/Goh1d2EX/aBuQDLHx4MV4Pg/ISh1hsZEmtKuP1XIUQ kP5OyZZ7cWWmzwzrcuOYU4Uf0iFHwR1yAIjdtH9dwj9837r3q4BnkaoboBB3owVQ2rxC XmtdluXnNPF7N3MStBe3c3VdOF0bj/Dd6OYy6adLX4yr0HRzpEeYlrDH4SA+8RdtpVl6 yXTwdscMT2KYXpJGDiEOWxTlmU4sA4XaTTD6A6bQVbhAJ+xPlDxv2zJlv8bNbtk3GRrj MUwuuM2CBRLw6JWIU2oqeytdvN2caBY8YWb9JmuQ7T1gPg1LM9KnwT5TaV7O/iiMIYzE EM2A==
X-Gm-Message-State AG10YOTKoGB+NFvm/LZVKCLoAg3074leurEBbMcjJK7MlPde6OWn73aF8hPZlD3H74m6VA==
X-Received by 10.67.24.104 with SMTP id ih8mr29716860pad.124.1454782738136; Sat, 06 Feb 2016 10:18:58 -0800 (PST)
Mail-Followup-To Jeremiah Mahler <jmmahler@gmail.com>, Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org, Matthew Wilcox <matthew.r.wilcox@intel.com>, Hugh Dickins <hughd@google.com>, Mel Gorman <mgorman@techsingularity.net>, Stephen Rothwell <sfr@canb.auug.org.au>, Konstantin Khlebnikov <koct9i@gmail.com>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.24 (2015-08-30)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 52
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, Matthew Wilcox <matthew.r.wilcox@intel.com>, Hugh Dickins <hughd@google.com>, Mel Gorman <mgorman@techsingularity.net>, Stephen Rothwell <sfr@canb.auug.org.au>, Konstantin Khlebnikov <koct9i@gmail.com>
X-Original-Date Sat, 6 Feb 2016 10:18:56 -0800
X-Original-Message-ID <20160206181856.GA7465@hudson.localdomain>
X-Original-References <20160205180502.GA5869@hudson.localdomain> <20160205141940.ecc0110b00347a264c868c43@linux-foundation.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1328346

Show key headers only | View raw


Andrew,

On Fri, Feb 05, 2016 at 02:19:40PM -0800, Andrew Morton wrote:
> On Fri, 5 Feb 2016 10:05:02 -0800 Jeremiah Mahler <jmmahler@gmail.com> wrote:
> 
[...]
> >   unable to handle kernel NULL pointer dereference
> 
> This should fix it up.
> 
[...]
> 
>  include/linux/radix-tree.h |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff -puN include/linux/radix-tree.h~radix-tree-fix-oops-after-radix_tree_iter_retry include/linux/radix-tree.h
> --- a/include/linux/radix-tree.h~radix-tree-fix-oops-after-radix_tree_iter_retry
> +++ a/include/linux/radix-tree.h
> @@ -400,7 +400,7 @@ void **radix_tree_iter_retry(struct radi
>   * @iter:	pointer to radix tree iterator
>   * Returns:	current chunk size
>   */
> -static __always_inline unsigned
> +static __always_inline long
>  radix_tree_chunk_size(struct radix_tree_iter *iter)
>  {
>  	return iter->next_index - iter->index;
> @@ -434,9 +434,9 @@ radix_tree_next_slot(void **slot, struct
>  			return slot + offset + 1;
>  		}
>  	} else {
> -		unsigned size = radix_tree_chunk_size(iter) - 1;
> +		long size = radix_tree_chunk_size(iter);
>  
> -		while (size--) {
> +		while (--size > 0) {
>  			slot++;
>  			iter->index++;
>  			if (likely(*slot))
> _
> 

I have applied this patch to my kernel and so far the bug has not
come back.  Thanks for the quick fix.

Although I don't quite understand how this fixes the slot==NULL problem.
Unless I am missing something, it looks like the while loop will be
executed the same number of times but the size variable will no
longer go negative as it did before.

-- 
- Jeremiah Mahler

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[REGRESSION] mm: filemap_map_pages NULL pointer dereference Jeremiah Mahler <jmmahler@gmail.com> - 2016-02-05 19:10 +0100
  Re: [REGRESSION] mm: filemap_map_pages NULL pointer dereference Andrew Morton <akpm@linux-foundation.org> - 2016-02-05 23:00 +0100
  Re: [REGRESSION] mm: filemap_map_pages NULL pointer dereference Andrew Morton <akpm@linux-foundation.org> - 2016-02-05 23:20 +0100
    Re: [REGRESSION] mm: filemap_map_pages NULL pointer dereference Jeremiah Mahler <jmmahler@gmail.com> - 2016-02-06 19:20 +0100
      Re: [REGRESSION] mm: filemap_map_pages NULL pointer dereference Konstantin Khlebnikov <koct9i@gmail.com> - 2016-02-07 09:30 +0100
        Re: [REGRESSION] mm: filemap_map_pages NULL pointer dereference Jeremiah Mahler <jmmahler@gmail.com> - 2016-02-07 16:50 +0100
    Re: [REGRESSION] mm: filemap_map_pages NULL pointer dereference Jeremiah Mahler <jmmahler@gmail.com> - 2016-02-07 17:00 +0100

csiph-web