mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steve G <linux_4ever@yahoo.com>
To: daniel.sobe@epost.de
Cc: linux-kernel@vger.kernel.org
Subject: Re: Swapoff w/regular file causes Oops
Date: Wed, 4 Jun 2003 05:55:54 -0700 (PDT)	[thread overview]
Message-ID: <20030604125554.95340.qmail@web9602.mail.yahoo.com> (raw)
In-Reply-To: <200305260630.39443.daniel.sobe@epost.de>

>Well, I had this problem when using RH8, but using kernel
>2.4.20-8 from RH9.

OK, I've investigated this further. It seems that all Red
Hat 2.4.18 kernels are immune to the swapoff problem. All
2.4.20 kernels (include the brand new one) have this bug. I
don't think anyone has tried the program I sent since it
would have caused an Oops and you'd see what I mean. I
don't think this is a Red Hat problem either, I think this
is generic to recent kernels.

Looking at the source for 2.4.20 kernel mm/swapfile.c
sys_swapoff function, the bug goes like this...swapoff
checks permissions, this is OK, it then gets the nameidata
entry for the filename, it checks to see if the file is on
the swap list, but its not (remember mkswap was never
called). err is set to -EINVAL and it jumps to out_dput
line 792. The kernel is unlocked and path_release() is
called (fs/namei.c line 253).

path_release() will unmount the entry and this is where the
Oops occurs. It was never mounted. It is simply a regular
file. It seems like there should be some check if err ==
-EINVAL that the file is in fact mounted. Looking at
__mntput (which is an inline function & maybe that's why
its not in the Oops call stack), it implicitly trusts that
the mnt parameter is not NULL & is valid. dput() at least
checks for NULL and does nothing.

I'm not too familiar with the kernel internals, but maybe
someone else can take what I've said and figure out the
right fix.

Best Regards,
-Steve Grubb


__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

  reply	other threads:[~2003-06-04 12:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-25 17:58 Steve G
2003-05-26 10:30 ` Daniel Sobe
2003-06-04 12:55   ` Steve G [this message]
2003-06-05 17:34 ` Mike Fedyk
2003-06-05 21:13   ` Steve G
2003-06-05 22:47     ` Mike Fedyk

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=20030604125554.95340.qmail@web9602.mail.yahoo.com \
    --to=linux_4ever@yahoo.com \
    --cc=daniel.sobe@epost.de \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®