From: Yue Haibing <yuehaibing@huawei.com>
To: <mst@redhat.com>, <jasowang@redhat.com>
Cc: <linux-kernel@vger.kernel.org>,
<virtualization@lists.linux-foundation.org>,
YueHaibing <yuehaibing@huawei.com>
Subject: [PATCH] virtio_ring: Fix potential mem leak in virtqueue_add_indirect_packed
Date: Tue, 12 Mar 2019 15:06:53 +0800 [thread overview]
Message-ID: <20190312070653.16392-1-yuehaibing@huawei.com> (raw)
From: YueHaibing <yuehaibing@huawei.com>
'desc' should be freed before leaving from err handing path.
Fixes: 1ce9e6055fa0 ("virtio_ring: introduce packed ring support")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/virtio/virtio_ring.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index a0b07c3..9d95d9c 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -991,6 +991,7 @@ static int virtqueue_add_indirect_packed(struct vring_virtqueue *vq,
if (unlikely(vq->vq.num_free < 1)) {
pr_debug("Can't add buf len 1 - avail = 0\n");
+ kfree(desc);
END_USE(vq);
return -ENOSPC;
}
--
2.7.0
next reply other threads:[~2019-03-12 7:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-12 7:06 Yue Haibing [this message]
2019-03-12 8:01 ` [PATCH] virtio_ring: Fix potential mem leak in virtqueue_add_indirect_packed Jason Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190312070653.16392-1-yuehaibing@huawei.com \
--to=yuehaibing@huawei.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).