From 1b81dddd354cf304574d79004400a6385613ae4e Mon Sep 17 00:00:00 2001 From: Amir Goldstein Date: Sat, 16 Nov 2019 18:52:20 +0200 Subject: ovl: fix corner case of conflicting lower layer uuid This fixes ovl_lower_uuid_ok() to correctly detect the corner case: - two filesystems, A and B, both have null uuid - upper layer is on A - lower layer 1 is also on A - lower layer 2 is on B In this case, bad_uuid would not have been set for B, because the check only involved the list of lower fs. Hence we'll try to decode a layer 2 origin on layer 1 and fail. We check for conflicting (and null) uuid among all lower layers, including those layers that are on the same fs as the upper layer. Reported-by: Miklos Szeredi Signed-off-by: Amir Goldstein Signed-off-by: Miklos Szeredi --- fs/overlayfs/ovl_entry.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fs/overlayfs/ovl_entry.h') diff --git a/fs/overlayfs/ovl_entry.h b/fs/overlayfs/ovl_entry.h index d9fbebdb6076..c9324ad47e15 100644 --- a/fs/overlayfs/ovl_entry.h +++ b/fs/overlayfs/ovl_entry.h @@ -24,6 +24,8 @@ struct ovl_sb { dev_t pseudo_dev; /* Unusable (conflicting) uuid */ bool bad_uuid; + /* Used as a lower layer (but maybe also as upper) */ + bool is_lower; }; struct ovl_layer { -- cgit v1.2.3-59-g8ed1b