Skip to content

Commit

Permalink
swsusp: fix error paths in snapshot_open
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Rafael J. Wysocki authored and Linus Torvalds committed May 7, 2007
1 parent 0429335 commit 1525a2a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions kernel/power/user.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1525a2a

Please sign in to comment.