Patch "9p: virtio: fix unlikely null pointer deref in handle_rerror" has been added to the 6.4-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

    9p: virtio: fix unlikely null pointer deref in handle_rerror

to the 6.4-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:
     9p-virtio-fix-unlikely-null-pointer-deref-in-handle_.patch
and it can be found in the queue-6.4 subdirectory.

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



commit f6b3be752c9c4a699435d44297c11307ae04d938
Author: Dominique Martinet <asmadeus@xxxxxxxxxxxxx>
Date:   Wed May 3 16:49:26 2023 +0900

    9p: virtio: fix unlikely null pointer deref in handle_rerror
    
    [ Upstream commit 13ade4ac5c28e8a014fa85278f5a4270b215f906 ]
    
    handle_rerror can dereference the pages pointer, but it is not
    necessarily set for small payloads.
    In practice these should be filtered out by the size check, but
    might as well double-check explicitly.
    
    This fixes the following scan-build warnings:
    net/9p/trans_virtio.c:401:24: warning: Dereference of null pointer [core.NullDereference]
                    memcpy_from_page(to, *pages++, offs, n);
                                         ^~~~~~~~
    net/9p/trans_virtio.c:406:23: warning: Dereference of null pointer (loaded from variable 'pages') [core.NullDereference]
            memcpy_from_page(to, *pages, offs, size);
                                 ^~~~~~
    
    Reviewed-by: Simon Horman <simon.horman@xxxxxxxxxxxx>
    Signed-off-by: Dominique Martinet <asmadeus@xxxxxxxxxxxxx>
    Signed-off-by: Eric Van Hensbergen <ericvh@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 3c27ffb781e3e..2c9495ccda6ba 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -384,7 +384,7 @@ static void handle_rerror(struct p9_req_t *req, int in_hdr_len,
 	void *to = req->rc.sdata + in_hdr_len;
 
 	// Fits entirely into the static data?  Nothing to do.
-	if (req->rc.size < in_hdr_len)
+	if (req->rc.size < in_hdr_len || !pages)
 		return;
 
 	// Really long error message?  Tough, truncate the reply.  Might get



[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