From: Suresh Jayaraman <sjayaraman@suse.de>
To: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: Rafael Wysocki <rjw@sisk.pl>, Jens Axboe <axboe@kernel.dk>,
LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] swapfile: avoid NULL pointer dereference in swapon when s_bdev is NULL
Date: Wed, 21 Oct 2009 18:13:21 +0530 [thread overview]
Message-ID: <4ADF01E9.4030404@suse.de> (raw)
In-Reply-To: <4ACC111A.8020500@suse.de>
Suresh Jayaraman wrote:
> Hugh Dickins wrote:
>> On Thu, 1 Oct 2009, Suresh Jayaraman wrote:
>>> Hugh Dickins wrote:
>>>> On Thu, 1 Oct 2009, Suresh Jayaraman wrote:
>>>>> The call sequence is add_to_swap() -> get_swap_page() -> scan_swap_map()
>>>>> -> discard_swap_cluster() -> blkdev_issue_discard().
>>>>>
>>>>> Wrapping the code around a NULL check fixes the Oops for me.
>>>> That's odd: scan_swap_map() should only discard_swap_cluster() if
>>>> SWP_DISCARDABLE got set, and your first patch made sure that it wasn't.
>>> I forgot to mention, this is not on loopback NFS mount but an remote NFS
>>> mount (so possibly s_bdev is not NULL) when doing swapon. The oops was
>>> triggered when memhog program tries to use the swap space on the newly
>>> created swapfile on NFS. I have not completely investigated the issue,
>>> perhaps s_bdev is not being set when it ought to be..
>> I'm happy to see your first patch already in 2.6.32-rc3, but still
>> suspicious of this second patch you sent afterwards. A quick skim
>> through your patchset suggests 23/31 is probably responsible:
>
> Thanks for skimming through those patches. I noticed this already during
> my review and thought I had already fixed this, but apparently I missed
> out. I'll test after fixing this and report.
Sorry about the delay. I tested by fixing SWP_FILE macro only now after
returning from vacation. I was not able to reproduce this. Please ignore
the second patch and it's no longer necessary as noted by Hugh already.
Thanks,
>> --- mmotm.orig/include/linux/swap.h
>> +++ mmotm/include/linux/swap.h
>> @@ -120,6 +120,7 @@ struct swap_extent {
>> enum {
>> SWP_USED = (1 << 0), /* is slot in swap_info[] used? */
>> SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */
>> + SWP_FILE = (1 << 2), /* file swap area */
>> SWP_DISCARDABLE = (1 << 2), /* blkdev supports discard */
>> SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */
>> SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */
>>
>> Hugh
>
> Thanks,
>
--
Suresh Jayaraman
prev parent reply other threads:[~2009-10-21 12:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-29 12:23 [PATCH] swapfile: avoid NULL pointer dereference in swapon when s_bdev is NULL Suresh Jayaraman
2009-09-30 6:57 ` Jens Axboe
2009-10-01 10:07 ` Hugh Dickins
2009-10-01 11:30 ` Suresh Jayaraman
2009-10-01 11:53 ` Hugh Dickins
2009-10-01 12:07 ` Suresh Jayaraman
2009-10-06 21:03 ` Hugh Dickins
2009-10-07 3:55 ` Suresh Jayaraman
2009-10-21 12:43 ` Suresh Jayaraman [this message]
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=4ADF01E9.4030404@suse.de \
--to=sjayaraman@suse.de \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=hugh.dickins@tiscali.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@sisk.pl \
/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 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.