ksmbd: defer notify_change() call
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 26 Aug 2021 08:05:17 +0000 (17:05 +0900)
committerSteve French <stfrench@microsoft.com>
Sat, 4 Sep 2021 04:29:45 +0000 (23:29 -0500)
commit28a5d3de9d65058f7edf8e5aaaf6b0a8d8f4a29f
tree7158d67ab41fe075fad601472c65bd5f0ed74396
parentdb7fb6fe3d7a8eb05f2b74c6252771c9362f3b74
ksmbd: defer notify_change() call

When ownership is changed we might in certain scenarios loose the
ability to alter the inode after we changed ownership. This can e.g.
happen when we are on an idmapped mount where uid 0 is mapped to uid
1000 and uid 1000 is mapped to uid 0.
A caller with fs*id 1000 will be able to create files as *id 1000 on
disk. They will also be able to change ownership of files owned by *id 0
to *id 1000 but they won't be able to change ownership in the other
direction. This means acl operations following notify_change() would
fail. Move the notify_change() call after the acls have been updated.
This guarantees that we don't end up with spurious "hash value diff"
warnings later on because we managed to change ownership but didn't
manage to alter acls.

Cc: Steve French <stfrench@microsoft.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Namjae Jeon <namjae.jeon@samsung.com>
Cc: Hyunchul Lee <hyc.lee@gmail.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: linux-cifs@vger.kernel.org
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/ksmbd/smbacl.c