From: "Jan Beulich" <JBeulich@novell.com>
To: <linux-kernel@vger.kernel.org>
Subject: [PATCH] for error-case kernel fault in sys_swapon
Date: Mon, 15 Mar 2004 12:55:44 +0100 [thread overview]
Message-ID: <s055999d.048@emea1-mh.id2.novell.com> (raw)
In the epilogue code, 'name' was passed to putname() regardless of
whether getname() succeeded, whereas 'swap_file' was cleared to NULL and
nevertheless checked through IS_ERR(). The patch fixes the first and
streamlines the second.
Jan Beulich
Novell, Inc.
--- 2.6.3/mm/swapfile.c.0 2004-03-02 16:35:17.000000000 +0100
+++ 2.6.3/mm/swapfile.c 2004-03-15 12:46:12.597498944 +0100
@@ -1269,8 +1269,10 @@
swap_list_unlock();
name = getname(specialfile);
error = PTR_ERR(name);
- if (IS_ERR(name))
+ if (IS_ERR(name)) {
+ name = NULL;
goto bad_swap_2;
+ }
swap_file = filp_open(name, O_RDWR, 0);
error = PTR_ERR(swap_file);
if (IS_ERR(swap_file)) {
@@ -1456,7 +1458,7 @@
destroy_swap_extents(p);
if (swap_map)
vfree(swap_map);
- if (swap_file && !IS_ERR(swap_file))
+ if (swap_file)
filp_close(swap_file, NULL);
out:
if (page && !IS_ERR(page)) {
reply other threads:[~2004-03-15 11:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=s055999d.048@emea1-mh.id2.novell.com \
--to=jbeulich@novell.com \
--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®