qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] virtiofsd: Fix potential NULL pointer dereference in virtio_send_msg()
@ 2020-12-10 15:14 Alex Chen
  2020-12-10 18:00 ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Chen @ 2020-12-10 15:14 UTC (permalink / raw)
  To: dgilbert, stefanha
  Cc: alex.chen, qemu-trivial, qemu-devel, zhang.zhanghailiang

The 'ch' will be NULL in the following stack:
send_notify_iov()->fuse_send_msg()->virtio_send_msg(),
so we should check 'ch' is valid before dereferencing it

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
---
 tools/virtiofsd/fuse_virtio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c
index 623812c432..31b2187a15 100644
--- a/tools/virtiofsd/fuse_virtio.c
+++ b/tools/virtiofsd/fuse_virtio.c
@@ -205,6 +205,8 @@ static void copy_iov(struct iovec *src_iov, int src_count,
 int virtio_send_msg(struct fuse_session *se, struct fuse_chan *ch,
                     struct iovec *iov, int count)
 {
+    assert(ch);
+
     FVRequest *req = container_of(ch, FVRequest, ch);
     struct fv_QueueInfo *qi = ch->qi;
     VuDev *dev = &se->virtio_dev->dev;
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-11 10:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-10 15:14 [PATCH] virtiofsd: Fix potential NULL pointer dereference in virtio_send_msg() Alex Chen
2020-12-10 18:00 ` Dr. David Alan Gilbert
2020-12-11 10:16   ` Alex Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).