Skip to content

Commit 64e7875

Browse files
namjaejeonSteve French
authored andcommitted
ksmbd: fix oops from fuse driver
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 <[email protected]> Cc: Ronnie Sahlberg <[email protected]> Cc: Ralph Böhme <[email protected]> Cc: Hyunchul Lee <[email protected]> Reported-by: Marios Makassikis <[email protected]> Tested-by: Marios Makassikis <[email protected]> Acked-by: Hyunchul Lee <[email protected]> Signed-off-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 2db7260 commit 64e7875

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

fs/ksmbd/smb2pdu.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5483,7 +5483,6 @@ static int set_file_basic_info(struct ksmbd_file *fp,
54835483
struct ksmbd_share_config *share)
54845484
{
54855485
struct iattr attrs;
5486-
struct timespec64 ctime;
54875486
struct file *filp;
54885487
struct inode *inode;
54895488
struct user_namespace *user_ns;
@@ -5505,13 +5504,11 @@ static int set_file_basic_info(struct ksmbd_file *fp,
55055504
attrs.ia_valid |= (ATTR_ATIME | ATTR_ATIME_SET);
55065505
}
55075506

5508-
if (file_info->ChangeTime) {
5507+
attrs.ia_valid |= ATTR_CTIME;
5508+
if (file_info->ChangeTime)
55095509
attrs.ia_ctime = ksmbd_NTtimeToUnix(file_info->ChangeTime);
5510-
ctime = attrs.ia_ctime;
5511-
attrs.ia_valid |= ATTR_CTIME;
5512-
} else {
5513-
ctime = inode->i_ctime;
5514-
}
5510+
else
5511+
attrs.ia_ctime = inode->i_ctime;
55155512

55165513
if (file_info->LastWriteTime) {
55175514
attrs.ia_mtime = ksmbd_NTtimeToUnix(file_info->LastWriteTime);
@@ -5557,11 +5554,9 @@ static int set_file_basic_info(struct ksmbd_file *fp,
55575554
return -EACCES;
55585555

55595556
inode_lock(inode);
5557+
inode->i_ctime = attrs.ia_ctime;
5558+
attrs.ia_valid &= ~ATTR_CTIME;
55605559
rc = notify_change(user_ns, dentry, &attrs, NULL);
5561-
if (!rc) {
5562-
inode->i_ctime = ctime;
5563-
mark_inode_dirty(inode);
5564-
}
55655560
inode_unlock(inode);
55665561
}
55675562
return rc;

0 commit comments

Comments
 (0)