diff options
author | Tim Hildering | 2019-02-18 00:01:18 +0100 |
---|---|---|
committer | Karel Zak | 2019-02-18 11:50:52 +0100 |
commit | beb60dbd6feab18fc75c5405dc52f6dce6fa4934 (patch) | |
tree | df5673580c2c740de6290f2a4b6325b1ada79d6f /libmount | |
parent | wall: remove unnecessary warning (diff) | |
download | kernel-qcow2-util-linux-beb60dbd6feab18fc75c5405dc52f6dce6fa4934.tar.gz kernel-qcow2-util-linux-beb60dbd6feab18fc75c5405dc52f6dce6fa4934.tar.xz kernel-qcow2-util-linux-beb60dbd6feab18fc75c5405dc52f6dce6fa4934.zip |
libmount: check table membership before adding entry
Added validation to function 'mnt_table_add_fs()' to check that added @fs
is not already a member of another table.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount')
-rw-r--r-- | libmount/src/tab.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libmount/src/tab.c b/libmount/src/tab.c index d80fb0579..7f08730ed 100644 --- a/libmount/src/tab.c +++ b/libmount/src/tab.c @@ -411,6 +411,9 @@ int mnt_table_add_fs(struct libmnt_table *tb, struct libmnt_fs *fs) if (!tb || !fs) return -EINVAL; + if (!list_empty(&fs->ents)) + return -EBUSY; + mnt_ref_fs(fs); list_add_tail(&fs->ents, &tb->ents); tb->nents++; |