hibernate: Allow uswsusp to write to swap
authorDomenico Andreoli <domenico.andreoli@linux.com>
Mon, 23 Mar 2020 15:22:15 +0000 (08:22 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Mon, 23 Mar 2020 15:22:15 +0000 (08:22 -0700)
commit56939e014a6c212b317414faa307029e2e80c3b9
tree62a198ce3602ceda172890a2a17c8001624a29f8
parent98d54f81e36ba3bf92172791eba5ca5bd813989b
hibernate: Allow uswsusp to write to swap

It turns out that there is one use case for programs being able to
write to swap devices, and that is the userspace hibernation code.

Quick fix: disable the S_SWAPFILE check if hibernation is configured.

Fixes: dc617f29dbe5 ("vfs: don't allow writes to swap files")
Reported-by: Domenico Andreoli <domenico.andreoli@linux.com>
Reported-by: Marian Klein <mkleinsoft@gmail.com>
Signed-off-by: Domenico Andreoli <domenico.andreoli@linux.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/block_dev.c