提交 1525a2ad 编写于 作者: R Rafael J. Wysocki 提交者: Linus Torvalds

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: NRafael J. Wysocki <rjw@sisk.pl>
Acked-by: NPavel Machek <pavel@ucw.cz>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 04293355
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册