Skip to content

Commit

Permalink
ksmbd: fix oops from fuse driver
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
namjaejeon authored and Steve French committed Oct 7, 2021
1 parent 2db7260 commit 64e7875
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions fs/ksmbd/smb2pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -5483,7 +5483,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;
struct user_namespace *user_ns;
Expand All @@ -5505,13 +5504,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);
Expand Down Expand Up @@ -5557,11 +5554,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(user_ns, dentry, &attrs, NULL);
if (!rc) {
inode->i_ctime = ctime;
mark_inode_dirty(inode);
}
inode_unlock(inode);
}
return rc;
Expand Down

0 comments on commit 64e7875

Please sign in to comment.