]> git.baikalelectronics.ru Git - kernel.git/commit
mm: fix refcounting in swapon
authorMiklos Szeredi <mszeredi@suse.cz>
Thu, 24 Feb 2011 14:49:53 +0000 (15:49 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 24 Feb 2011 16:55:01 +0000 (08:55 -0800)
commit010c27f6a71af15f18d1e0eb8da152284999d66b
tree7f4870224b54121fbfea83cd77ea41f7ab3a00d8
parentf2efa9dec494f04c8c47d5ba2acf7a251e3cf943
mm: fix refcounting in swapon

Grab a reference to bdev before calling blkdev_get(), which expects
the refcount to be already incremented and either returns success or
decrements the refcount and returns an error.

The bug was introduced by 07694f05 (block: make blkdev_get/put()
handle exclusive access), which didn't take into account this behavior
of blkdev_get().

Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/swapfile.c