32 lines
1.1 KiB
Diff
32 lines
1.1 KiB
Diff
From d9f3fc321672406f959334509a88296187994c5a Mon Sep 17 00:00:00 2001
|
|
From: Namjae Jeon <linkinjeon@kernel.org>
|
|
Date: Tue, 15 Apr 2025 09:31:08 +0900
|
|
Subject: ksmbd: fix the warning from __kernel_write_iter
|
|
|
|
[ 2110.972290] ------------[ cut here ]------------
|
|
[ 2110.972301] WARNING: CPU: 3 PID: 735 at fs/read_write.c:599 __kernel_write_iter+0x21b/0x280
|
|
|
|
This patch doesn't allow writing to directory.
|
|
|
|
Cc: stable@vger.kernel.org
|
|
Reported-by: Norbert Szetei <norbert@doyensec.com>
|
|
Tested-by: Norbert Szetei <norbert@doyensec.com>
|
|
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
|
|
Signed-off-by: Steve French <stfrench@microsoft.com>
|
|
---
|
|
fs/smb/server/vfs.c | 3 ++-
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
--- a/fs/smb/server/vfs.c
|
|
+++ b/fs/smb/server/vfs.c
|
|
@@ -496,7 +496,8 @@ int ksmbd_vfs_write(struct ksmbd_work *w
|
|
int err = 0;
|
|
|
|
if (work->conn->connection_type) {
|
|
- if (!(fp->daccess & (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE))) {
|
|
+ if (!(fp->daccess & (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE)) ||
|
|
+ S_ISDIR(file_inode(fp->filp)->i_mode)) {
|
|
pr_err("no right to write(%pD)\n", fp->filp);
|
|
err = -EACCES;
|
|
goto out;
|