linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Matthew Wilcox <willy@infradead.org>
Cc: Naresh Kamboju <naresh.kamboju@linaro.org>,
	open list <linux-kernel@vger.kernel.org>, X86 ML <x86@kernel.org>,
	linux-fsdevel@vger.kernel.org, linux-mm <linux-mm@kvack.org>,
	Linux-Next Mailing List <linux-next@vger.kernel.org>,
	lkft-triage@lists.linaro.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Hugh Dickins <hughd@google.com>,
	William Kucharski <william.kucharski@oracle.com>,
	gandalf@winds.org, Qian Cai <cai@lca.pw>,
	Mike Kravetz <mike.kravetz@oracle.com>,
	Michal Hocko <mhocko@suse.com>, Yang Shi <shy828301@gmail.com>,
	Shakeel Butt <shakeelb@google.com>
Subject: Re: BUG: kernel NULL pointer dereference, address: RIP: 0010:shmem_getpage_gfp.isra.0+0x470/0x750
Date: Tue, 15 Sep 2020 16:52:43 +1000	[thread overview]
Message-ID: <20200915165243.58379eb7@canb.auug.org.au> (raw)
In-Reply-To: <20200914115559.GN6583@casper.infradead.org>

[-- Attachment #1: Type: text/plain, Size: 1712 bytes --]

Hi all,

On Mon, 14 Sep 2020 12:55:59 +0100 Matthew Wilcox <willy@infradead.org> wrote:
>
> On Mon, Sep 14, 2020 at 03:49:43PM +0530, Naresh Kamboju wrote:
> > While running LTP fs on qemu x86 and qemu_i386 these kernel BUGs noticed.  
> 
> I actually sent the fix for this a couple of days ago [1], but I think Andrew
> overlooked it while constructing the -mm tree.  Here's a fix you can
> apply to the -mm tree:
> 
> [1] https://lore.kernel.org/linux-mm/20200912032042.GA6583@casper.infradead.org/
> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index d2a46ef7df43..58bc9e326d0d 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -1793,7 +1793,7 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
>  	struct mm_struct *charge_mm;
>  	struct page *page;
>  	enum sgp_type sgp_huge = sgp;
> -	pgoff_t hindex;
> +	pgoff_t hindex = index;
>  	int error;
>  	int once = 0;
>  	int alloced = 0;
> @@ -1822,6 +1822,8 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
>  		return error;
>  	}
>  
> +	if (page)
> +		hindex = page->index;
>  	if (page && sgp == SGP_WRITE)
>  		mark_page_accessed(page);
>  
> @@ -1832,6 +1834,7 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
>  		unlock_page(page);
>  		put_page(page);
>  		page = NULL;
> +		hindex = index;
>  	}
>  	if (page || sgp == SGP_READ)
>  		goto out;
> @@ -1982,7 +1985,7 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
>  		goto unlock;
>  	}
>  out:
> -	*pagep = page + index - page->index;
> +	*pagep = page + index - hindex;
>  	return 0;
>  
>  	/*

I have applied that to linux-next today.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-09-15  6:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-14 10:19 Naresh Kamboju
2020-09-14 11:55 ` Matthew Wilcox
2020-09-15  6:52   ` Stephen Rothwell [this message]
2020-09-15 13:10     ` Matthew Wilcox
2020-09-15 22:52       ` Stephen Rothwell

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=20200915165243.58379eb7@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=akpm@linux-foundation.org \
    --cc=cai@lca.pw \
    --cc=gandalf@winds.org \
    --cc=hughd@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-next@vger.kernel.org \
    --cc=lkft-triage@lists.linaro.org \
    --cc=mhocko@suse.com \
    --cc=mike.kravetz@oracle.com \
    --cc=naresh.kamboju@linaro.org \
    --cc=shakeelb@google.com \
    --cc=shy828301@gmail.com \
    --cc=william.kucharski@oracle.com \
    --cc=willy@infradead.org \
    --cc=x86@kernel.org \
    /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