From: Rafael J. Wysocki Date: Sun, 6 May 2007 21:50:44 +0000 (-0700) Subject: swsusp: fix error paths in snapshot_open X-Git-Tag: MMI-PSA29.97-13-9~44045 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1525a2ad76f991eba9755f75c9b6d4d97abad25e;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git swsusp: fix error paths in snapshot_open 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 Acked-by: Pavel Machek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/power/user.c b/kernel/power/user.c index 845acd84cb23..bd1771f7a64e 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c @@ -49,12 +49,14 @@ static int snapshot_open(struct inode *inode, struct file *filp) 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;