From beb60dbd6feab18fc75c5405dc52f6dce6fa4934 Mon Sep 17 00:00:00 2001 From: Tim Hildering Date: Mon, 18 Feb 2019 00:01:18 +0100 Subject: [PATCH] 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 --- libmount/src/tab.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libmount/src/tab.c b/libmount/src/tab.c index d80fb0579b..7f08730edc 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++; -- 2.47.2