mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 04:47:05 +00:00
9p: virtio: fix unlikely null pointer deref in handle_rerror
[ Upstream commit 13ade4ac5c
]
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@corigine.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
15559ac9d1
commit
00d31fe4bf
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue