]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ovl: append MAY_READ when diluting write checks
authorVivek Goyal <vgoyal@redhat.com>
Wed, 13 Jul 2016 15:00:14 +0000 (11:00 -0400)
committerShan Hai <shan.hai@oracle.com>
Fri, 4 Aug 2017 05:51:51 +0000 (13:51 +0800)
commit41094077f636dcb07ce4333f9ff66404d9a1b18f
treed92af80e3c59529bf9a19282dec90fa8b8811db5
parent4c626f526e089031bd4a373baeb901c6bd260e3b
ovl: append MAY_READ when diluting write checks

Right now we remove MAY_WRITE/MAY_APPEND bits from mask if realfile is on
lower/. This is done as files on lower will never be written and will be
copied up. But to copy up a file, mounter should have MAY_READ permission
otherwise copy up will fail. So set MAY_READ in mask when MAY_WRITE is
reset.

Dan Walsh noticed this when he did access(lowerfile, W_OK) and it returned
True (context mounts) but when he tried to actually write to file, it
failed as mounter did not have permission on lower file.

[SzM] don't set MAY_READ if only MAY_APPEND is set without MAY_WRITE; this
won't trigger a copy-up.

Reported-by: Dan Walsh <dwalsh@redhat.com>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Orabug: 26401569

(backport upstream commit 500cac3ccee65526d5075da3af2674101305bf8c)

Signed-off-by: Shan Hai <shan.hai@oracle.com>
Reviewed-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
fs/overlayfs/inode.c