https://github.com/torvalds/linux
Revision a1bb7d61233ba5fb5cd865f907a9ddcc8f8c02bd authored by Alan Jenkins on 14 February 2009, 01:01:14 UTC, committed by Linus Torvalds on 21 February 2009, 22:17:17 UTC
http://bugzilla.kernel.org/show_bug.cgi?id=12239

The image writing code dropped a reference to the current swap device.
This doesn't show up if the hibernation succeeds - because it doesn't
affect the image which gets resumed.  But it means multiple _failed_
hibernations end up freeing the swap device while it is still use!

swsusp_write() finds the block device for the swap file using swap_type_of().
It then uses blkdev_get() / blkdev_put() to open and close the block device.

Unfortunately, blkdev_get() assumes ownership of the inode of the block_device
passed to it.  So blkdev_put() calls iput() on the inode.  This is by design
and other callers expect this behaviour.  The fix is for swap_type_of() to take
a reference on the inode using bdget().

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Len Brown <lenb@kernel.org>
Cc: Greg KH <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent eed3ee0
History
Tip revision: a1bb7d61233ba5fb5cd865f907a9ddcc8f8c02bd authored by Alan Jenkins on 14 February 2009, 01:01:14 UTC
PM/hibernate: fix "swap breaks after hibernation failures"
Tip revision: a1bb7d6
File Mode Size
async_tx
Kconfig -rw-r--r-- 20.8 KB
Makefile -rw-r--r-- 2.8 KB
ablkcipher.c -rw-r--r-- 8.8 KB
aead.c -rw-r--r-- 12.2 KB
aes_generic.c -rw-r--r-- 61.8 KB
ahash.c -rw-r--r-- 5.5 KB
algapi.c -rw-r--r-- 16.3 KB
algboss.c -rw-r--r-- 5.9 KB
ansi_cprng.c -rw-r--r-- 9.5 KB
anubis.c -rw-r--r-- 27.8 KB
api.c -rw-r--r-- 13.4 KB
arc4.c -rw-r--r-- 2.0 KB
authenc.c -rw-r--r-- 13.1 KB
blkcipher.c -rw-r--r-- 18.6 KB
blowfish.c -rw-r--r-- 17.5 KB
camellia.c -rw-r--r-- 35.1 KB
cast5.c -rw-r--r-- 34.1 KB
cast6.c -rw-r--r-- 21.5 KB
cbc.c -rw-r--r-- 7.4 KB
ccm.c -rw-r--r-- 21.5 KB
chainiv.c -rw-r--r-- 8.5 KB
cipher.c -rw-r--r-- 3.3 KB
compress.c -rw-r--r-- 1.3 KB
crc32c.c -rw-r--r-- 8.0 KB
cryptd.c -rw-r--r-- 15.3 KB
crypto_null.c -rw-r--r-- 4.9 KB
ctr.c -rw-r--r-- 10.8 KB
cts.c -rw-r--r-- 9.8 KB
deflate.c -rw-r--r-- 5.5 KB
des_generic.c -rw-r--r-- 35.4 KB
digest.c -rw-r--r-- 5.7 KB
ecb.c -rw-r--r-- 4.9 KB
eseqiv.c -rw-r--r-- 6.6 KB
fcrypt.c -rw-r--r-- 18.0 KB
fips.c -rw-r--r-- 705 bytes
gcm.c -rw-r--r-- 19.8 KB
gf128mul.c -rw-r--r-- 13.2 KB
hash.c -rw-r--r-- 4.8 KB
hmac.c -rw-r--r-- 7.2 KB
internal.h -rw-r--r-- 4.3 KB
khazad.c -rw-r--r-- 51.8 KB
krng.c -rw-r--r-- 1.5 KB
lrw.c -rw-r--r-- 7.5 KB
lzo.c -rw-r--r-- 2.5 KB
md4.c -rw-r--r-- 6.1 KB
md5.c -rw-r--r-- 7.2 KB
michael_mic.c -rw-r--r-- 3.6 KB
pcbc.c -rw-r--r-- 7.7 KB
proc.c -rw-r--r-- 4.0 KB
ripemd.h -rw-r--r-- 974 bytes
rmd128.c -rw-r--r-- 10.1 KB
rmd160.c -rw-r--r-- 12.6 KB
rmd256.c -rw-r--r-- 10.5 KB
rmd320.c -rw-r--r-- 13.0 KB
rng.c -rw-r--r-- 2.8 KB
salsa20_generic.c -rw-r--r-- 6.7 KB
scatterwalk.c -rw-r--r-- 2.9 KB
seed.c -rw-r--r-- 17.4 KB
seqiv.c -rw-r--r-- 8.5 KB
serpent.c -rw-r--r-- 19.8 KB
sha1_generic.c -rw-r--r-- 3.1 KB
sha256_generic.c -rw-r--r-- 12.1 KB
sha512_generic.c -rw-r--r-- 9.1 KB
shash.c -rw-r--r-- 13.1 KB
tcrypt.c -rw-r--r-- 18.5 KB
tcrypt.h -rw-r--r-- 2.3 KB
tea.c -rw-r--r-- 7.1 KB
testmgr.c -rw-r--r-- 39.9 KB
testmgr.h -rw-r--r-- 284.5 KB
tgr192.c -rw-r--r-- 30.8 KB
twofish.c -rw-r--r-- 6.3 KB
twofish_common.c -rw-r--r-- 37.7 KB
wp512.c -rw-r--r-- 60.1 KB
xcbc.c -rw-r--r-- 9.0 KB
xor.c -rw-r--r-- 3.6 KB
xts.c -rw-r--r-- 7.1 KB

back to top