LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Pavel Machek <pavel@ucw.cz>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 4/5] swsusp: fix error paths in snapshot_open
Date: Tue, 20 Mar 2007 22:26:42 +0100 [thread overview]
Message-ID: <200703202226.42673.rjw@sisk.pl> (raw)
In-Reply-To: <200703202218.16820.rjw@sisk.pl>
From: Rafael J. Wysocki <rjw@sisk.pl>
We forget to increase device_available if there's an error in
snapshot_open(), so the snapshot device cannot be open at all after
snapshot_open() has returned an error.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
kernel/power/user.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
Index: linux-2.6.21-rc4-mm1/kernel/power/user.c
===================================================================
--- linux-2.6.21-rc4-mm1.orig/kernel/power/user.c 2007-03-20 21:19:31.000000000 +0100
+++ linux-2.6.21-rc4-mm1/kernel/power/user.c 2007-03-20 21:35:59.000000000 +0100
@@ -49,12 +49,14 @@ static int snapshot_open(struct inode *i
if (!atomic_add_unless(&device_available, -1, 0))
return -EBUSY;
- if ((filp->f_flags & O_ACCMODE) == O_RDWR)
+ if ((filp->f_flags & O_ACCMODE) == O_RDWR) {
+ atomic_inc(&device_available);
return -ENOSYS;
-
- if(create_basic_memory_bitmaps())
+ }
+ if(create_basic_memory_bitmaps()) {
+ atomic_inc(&device_available);
return -ENOMEM;
-
+ }
nonseekable_open(inode, filp);
data = &snapshot_state;
filp->private_data = data;
next prev parent reply other threads:[~2007-03-20 21:27 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-12 21:14 [PATCH 0/3] swsusp: Stop using page flags Rafael J. Wysocki
2007-03-12 21:16 ` [PATCH 1/3] swsusp: Use inline functions for changing " Rafael J. Wysocki
2007-03-12 21:19 ` [PATCH 2/3] swsusp: Do not use " Rafael J. Wysocki
2007-03-15 19:08 ` Andrew Morton
2007-03-15 21:05 ` Rafael J. Wysocki
2007-03-15 21:29 ` Andrew Morton
2007-03-15 22:19 ` Jiri Kosina
2007-03-15 22:23 ` Andrew Morton
2007-03-16 0:01 ` Rafael J. Wysocki
2007-03-15 23:05 ` Pavel Machek
2007-03-20 0:31 ` Andrew Morton
2007-03-20 13:18 ` Pavel Machek
2007-03-20 21:18 ` Rafael J. Wysocki
2007-03-20 21:20 ` [PATCH 1/5] swsusp: Use inline functions for changing " Rafael J. Wysocki
2007-03-20 21:22 ` [PATCH 2/5] swsusp: do not use " Rafael J. Wysocki
2007-03-20 21:25 ` [PATCH 3/5] mm: remove unused " Rafael J. Wysocki
2007-03-20 21:26 ` Rafael J. Wysocki [this message]
2007-03-20 22:16 ` [PATCH 4/5] swsusp: fix error paths in snapshot_open Pavel Machek
2007-03-20 22:24 ` Rafael J. Wysocki
2007-03-20 22:24 ` Pavel Machek
2007-03-20 22:52 ` Rafael J. Wysocki
2007-03-20 21:28 ` [PATCH 5/5] swsusp: Use GFP_KERNEL for creating basic data structures Rafael J. Wysocki
2007-03-20 22:17 ` Pavel Machek
2007-03-12 21:20 ` [PATCH 3/3] mm: Remove unused page flags Rafael J. Wysocki
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=200703202226.42673.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
--subject='Re: [PATCH 4/5] swsusp: fix error paths in snapshot_open' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).