Patch "ksmbd: fix Null pointer dereferences in ksmbd_update_fstate()" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ksmbd: fix Null pointer dereferences in ksmbd_update_fstate()

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ksmbd-fix-null-pointer-dereferences-in-ksmbd_update_.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 402b062ba5000a9682a8d3c575f2284158a9c37f
Author: Namjae Jeon <linkinjeon@xxxxxxxxxx>
Date:   Sun Dec 31 16:13:09 2023 +0900

    ksmbd: fix Null pointer dereferences in ksmbd_update_fstate()
    
    [ Upstream commit 414849040fcf11d45025b8ae26c9fd91da1465da ]
    
    Coverity Scan report the following one. This report is a false alarm.
    Because fp is never NULL when rc is zero. This patch add null check for fp
    in ksmbd_update_fstate to make alarm silence.
    
    *** CID 1568583:  Null pointer dereferences  (FORWARD_NULL)
    /fs/smb/server/smb2pdu.c: 3408 in smb2_open()
    3402                    path_put(&path);
    3403                    path_put(&parent_path);
    3404            }
    3405            ksmbd_revert_fsids(work);
    3406     err_out1:
    3407            if (!rc) {
    >>>     CID 1568583:  Null pointer dereferences  (FORWARD_NULL)
    >>>     Passing null pointer "fp" to "ksmbd_update_fstate", which dereferences it.
    3408                    ksmbd_update_fstate(&work->sess->file_table, fp, FP_INITED);
    3409                    rc = ksmbd_iov_pin_rsp(work, (void *)rsp, iov_len);
    3410            }
    3411            if (rc) {
    3412                    if (rc == -EINVAL)
    3413                            rsp->hdr.Status = STATUS_INVALID_PARAMETER;
    
    Fixes: e2b76ab8b5c9 ("ksmbd: add support for read compound")
    Reported-by: Coverity Scan <scan-admin@xxxxxxxxxxxx>
    Signed-off-by: Namjae Jeon <linkinjeon@xxxxxxxxxx>
    Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/smb/server/vfs_cache.c b/fs/smb/server/vfs_cache.c
index f600279b0a9ee..38f414e803adb 100644
--- a/fs/smb/server/vfs_cache.c
+++ b/fs/smb/server/vfs_cache.c
@@ -602,6 +602,9 @@ struct ksmbd_file *ksmbd_open_fd(struct ksmbd_work *work, struct file *filp)
 void ksmbd_update_fstate(struct ksmbd_file_table *ft, struct ksmbd_file *fp,
 			 unsigned int state)
 {
+	if (!fp)
+		return;
+
 	write_lock(&ft->lock);
 	fp->f_state = state;
 	write_unlock(&ft->lock);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux