summaryrefslogtreecommitdiffstats
path: root/disk-utils/fsck.c
diff options
context:
space:
mode:
authorYuriy M. Kaminskiy2016-04-07 23:38:56 +0200
committerKarel Zak2016-04-22 11:07:42 +0200
commitfc75981a229a52ee8f5245c4a036dd151e4a70fc (patch)
tree08ab63ac21f698fcb4c71edb0ef5d131f997d742 /disk-utils/fsck.c
parentnsenter: enter namespaces in two passes (diff)
downloadkernel-qcow2-util-linux-fc75981a229a52ee8f5245c4a036dd151e4a70fc.tar.gz
kernel-qcow2-util-linux-fc75981a229a52ee8f5245c4a036dd151e4a70fc.tar.xz
kernel-qcow2-util-linux-fc75981a229a52ee8f5245c4a036dd151e4a70fc.zip
fsck: fix racing between unlock/unlink and open
Process A Process B Process C open() [creates file] lock() [succeed] open() [open existing] lock()... running() close() [...succeed] unlink() running() open() [creates file] {BAD!} lock() [succeed] {BAD!} running() {BAD!} close() Cons: leaves empty (unlocked/harmless) .lock files in /run/fsck/ Signed-off-by: Yuriy M. Kaminskiy <yumkam@gmail.com>
Diffstat (limited to 'disk-utils/fsck.c')
-rw-r--r--disk-utils/fsck.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/disk-utils/fsck.c b/disk-utils/fsck.c
index 05cfbc439..84d2dcc3d 100644
--- a/disk-utils/fsck.c
+++ b/disk-utils/fsck.c
@@ -410,7 +410,6 @@ static void unlock_disk(struct fsck_instance *inst)
printf(_("Unlocking %s.\n"), inst->lockpath);
close(inst->lock); /* unlock */
- unlink(inst->lockpath);
free(inst->lockpath);