[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200703202226.42673.rjw@sisk.pl>
Date: Tue, 20 Mar 2007 22:26:42 +0100
From: "Rafael J. Wysocki" <rjw@...k.pl>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Pavel Machek <pavel@....cz>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 4/5] swsusp: fix error paths in snapshot_open
From: Rafael J. Wysocki <rjw@...k.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@...k.pl>
Acked-by: Pavel Machek <pavel@....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;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists