From: Tim Hildering Date: Sun, 17 Feb 2019 23:01:18 +0000 (+0100) Subject: libmount: check table membership before adding entry X-Git-Tag: v2.34-rc1~110 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=beb60dbd6feab18fc75c5405dc52f6dce6fa4934;p=thirdparty%2Futil-linux.git 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 --- 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++;