From: Marios Makassikis mmakassikis@freebox.fr
mainline inclusion from mainline-5.15-rc1 commit a4382db9bac314440f662be91ec8010465e67603 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I60T7G CVE: NA
Reference: https://git.kernel.org/torvalds/linux/c/a4382db9bac3
-------------------------------
Call smb2_set_err_rsp() in smb2_read/smb2_write error path.
Signed-off-by: Marios Makassikis mmakassikis@freebox.fr Signed-off-by: Namjae Jeon namjae.jeon@samsung.com Signed-off-by: Steve French stfrench@microsoft.com Signed-off-by: Jason Yan yanaijie@huawei.com Signed-off-by: Zhong Jinghua zhongjinghua@huawei.com --- fs/cifsd/smb2pdu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/cifsd/smb2pdu.c b/fs/cifsd/smb2pdu.c index 3b8da5dfd4a1..e5aff1ca11e1 100644 --- a/fs/cifsd/smb2pdu.c +++ b/fs/cifsd/smb2pdu.c @@ -5820,8 +5820,8 @@ int smb2_read(struct ksmbd_work *work) le64_to_cpu(req->VolatileFileId), le64_to_cpu(req->PersistentFileId)); if (!fp) { - rsp->hdr.Status = STATUS_FILE_CLOSED; - return -ENOENT; + err = -ENOENT; + goto out; }
if (!(fp->daccess & (FILE_READ_DATA_LE | FILE_READ_ATTRIBUTES_LE))) { @@ -6057,7 +6057,7 @@ int smb2_write(struct ksmbd_work *work) { struct smb2_write_req *req; struct smb2_write_rsp *rsp, *rsp_org; - struct ksmbd_file *fp = NULL; + struct ksmbd_file *fp; loff_t offset; size_t length; ssize_t nbytes; @@ -6082,8 +6082,8 @@ int smb2_write(struct ksmbd_work *work) fp = ksmbd_lookup_fd_slow(work, le64_to_cpu(req->VolatileFileId), le64_to_cpu(req->PersistentFileId)); if (!fp) { - rsp->hdr.Status = STATUS_FILE_CLOSED; - return -ENOENT; + err = -ENOENT; + goto out; }
if (!(fp->daccess & (FILE_WRITE_DATA_LE | FILE_READ_ATTRIBUTES_LE))) {