提交 ca3dd0d7 编写于 作者: N Namjae Jeon 提交者: Zhong Jinghua

ksmbd: fix oops from fuse driver

mainline inclusion
from mainline-5.15-rc5
commit 64e78755
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I60T7G
CVE: NA

Reference: https://git.kernel.org/torvalds/linux/c/64e787556027

-------------------------------

Marios reported kernel oops from fuse driver when ksmbd call
mark_inode_dirty(). This patch directly update ->i_ctime after removing
mark_inode_ditry() and notify_change will put inode to dirty list.

Cc: Tom Talpey <tom@talpey.com>
Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Cc: Ralph Böhme <slow@samba.org>
Cc: Hyunchul Lee <hyc.lee@gmail.com>
Reported-by: NMarios Makassikis <mmakassikis@freebox.fr>
Tested-by: NMarios Makassikis <mmakassikis@freebox.fr>
Acked-by: NHyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: NNamjae Jeon <linkinjeon@kernel.org>
Signed-off-by: NSteve French <stfrench@microsoft.com>
Signed-off-by: NJason Yan <yanaijie@huawei.com>
Signed-off-by: NZhong Jinghua <zhongjinghua@huawei.com>
上级 f6291f07
......@@ -5438,7 +5438,6 @@ static int set_file_basic_info(struct ksmbd_file *fp,
struct ksmbd_share_config *share)
{
struct iattr attrs;
struct timespec64 ctime;
struct file *filp;
struct inode *inode;
int rc = 0;
......@@ -5458,13 +5457,11 @@ static int set_file_basic_info(struct ksmbd_file *fp,
attrs.ia_valid |= (ATTR_ATIME | ATTR_ATIME_SET);
}
if (file_info->ChangeTime) {
attrs.ia_valid |= ATTR_CTIME;
if (file_info->ChangeTime)
attrs.ia_ctime = ksmbd_NTtimeToUnix(file_info->ChangeTime);
ctime = attrs.ia_ctime;
attrs.ia_valid |= ATTR_CTIME;
} else {
ctime = inode->i_ctime;
}
else
attrs.ia_ctime = inode->i_ctime;
if (file_info->LastWriteTime) {
attrs.ia_mtime = ksmbd_NTtimeToUnix(file_info->LastWriteTime);
......@@ -5509,11 +5506,9 @@ static int set_file_basic_info(struct ksmbd_file *fp,
return -EACCES;
inode_lock(inode);
inode->i_ctime = attrs.ia_ctime;
attrs.ia_valid &= ~ATTR_CTIME;
rc = notify_change(dentry, &attrs, NULL);
if (!rc) {
inode->i_ctime = ctime;
mark_inode_dirty(inode);
}
inode_unlock(inode);
}
return rc;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册