]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ksmbd: don't allow O_TRUNC open on read-only share
authorNamjae Jeon <linkinjeon@kernel.org>
Sun, 7 Jan 2024 12:24:07 +0000 (21:24 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Jan 2024 10:50:10 +0000 (11:50 +0100)
commit09d84f37f8412fbb2bd73447bbecb68310e4b378
treee790772b4f89115084112a8328aecd1218aaa16a
parentc24fc060ab7fd2536830234428ffea649d318ffb
ksmbd: don't allow O_TRUNC open on read-only share

commit d592a9158a112d419f341f035d18d02f8d232def upstream.

When file is changed using notepad on read-only share(read_only = yes in
ksmbd.conf), There is a problem where existing data is truncated.
notepad in windows try to O_TRUNC open(FILE_OVERWRITE_IF) and all data
in file is truncated. This patch don't allow  O_TRUNC open on read-only
share and add KSMBD_TREE_CONN_FLAG_WRITABLE check in smb2_set_info().

Cc: stable@vger.kernel.org
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/smb/server/smb2pdu.c