summaryrefslogtreecommitdiffstats
path: root/mount
diff options
context:
space:
mode:
authorKarel Zak2011-04-13 10:49:26 +0200
committerKarel Zak2011-04-13 10:49:26 +0200
commit47a226b7e59ba8fc56603a20eec19ab69c9ccc4e (patch)
treeb2af36ba4966b5e9ae666738f9a7127e8af9558d /mount
parentumount: block signals when umounting and updating mtab (CVE-2011-1676, CVE-20... (diff)
downloadkernel-qcow2-util-linux-47a226b7e59ba8fc56603a20eec19ab69c9ccc4e.tar.gz
kernel-qcow2-util-linux-47a226b7e59ba8fc56603a20eec19ab69c9ccc4e.tar.xz
kernel-qcow2-util-linux-47a226b7e59ba8fc56603a20eec19ab69c9ccc4e.zip
mount: use lock from mnt_update_table()
The mnt_update_table() is able to create a mtab lock now. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount')
-rw-r--r--mount/fstab.c19
-rw-r--r--mount/fstab.h1
-rw-r--r--mount/mount.c4
-rw-r--r--mount/umount.c9
4 files changed, 4 insertions, 29 deletions
diff --git a/mount/fstab.c b/mount/fstab.c
index c04e9733e..8ce733bf8 100644
--- a/mount/fstab.c
+++ b/mount/fstab.c
@@ -578,21 +578,6 @@ setlkw_timeout (int sig) {
/* nothing, fcntl will fail anyway */
}
-#ifdef HAVE_LIBMOUNT_MOUNT
-static struct libmnt_lock *libmount_lock;
-
-struct libmnt_lock *
-init_libmount_lock(const char *filename)
-{
- if (filename)
- return libmount_lock = mnt_new_lock(filename, 0);
- if (libmount_lock)
- mnt_free_lock(libmount_lock);
- libmount_lock = NULL;
- return NULL;
-}
-#endif
-
/* Remove lock file. */
void
unlock_mtab (void) {
@@ -602,10 +587,6 @@ unlock_mtab (void) {
unlink (_PATH_MOUNTED_LOCK);
we_created_lockfile = 0;
}
-#ifdef HAVE_LIBMOUNT_MOUNT
- if (libmount_lock)
- mnt_unlock_file(libmount_lock);
-#endif
}
/* Create the lock file.
diff --git a/mount/fstab.h b/mount/fstab.h
index 15a7ecad6..bbef33b51 100644
--- a/mount/fstab.h
+++ b/mount/fstab.h
@@ -6,7 +6,6 @@
#ifdef HAVE_LIBMOUNT_MOUNT
#define USE_UNSTABLE_LIBMOUNT_API
#include <libmount.h>
-extern struct libmnt_lock *init_libmount_lock(const char *filename);
#endif
int mtab_is_writable(void);
diff --git a/mount/mount.c b/mount/mount.c
index aa59304bc..b786368f9 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -1403,9 +1403,7 @@ static void update_mtab_entry(int flags)
create_mtab ();
}
- lc = init_libmount_lock( mnt_update_get_filename(mtab_update) );
- mnt_update_table(mtab_update, lc);
- init_libmount_lock(NULL);
+ mnt_update_table(mtab_update, NULL);
}
mnt_free_update(mtab_update);
diff --git a/mount/umount.c b/mount/umount.c
index c87af6b2c..0349cb3fc 100644
--- a/mount/umount.c
+++ b/mount/umount.c
@@ -417,12 +417,9 @@ umount_one (const char *spec, const char *node, const char *type,
#ifdef HAVE_LIBMOUNT_MOUNT
struct libmnt_update *upd = mnt_new_update();
- if (upd && !mnt_update_set_fs(upd, 0, node, NULL)) {
- struct libmnt_lock *lc = init_libmount_lock(
- mnt_update_get_filename(upd));
- mnt_update_table(upd, lc);
- init_libmount_lock(NULL);
- }
+ if (upd && !mnt_update_set_fs(upd, 0, node, NULL))
+ mnt_update_table(upd, NULL);
+
mnt_free_update(upd);
#else
update_mtab (node, NULL);