* [PATCH 1/1] vhost: fix missing descriptor chains length checks
@ 2024-12-23 3:29 Yunjian Wang
2025-03-04 12:29 ` Maxime Coquelin
2025-03-04 13:42 ` Maxime Coquelin
0 siblings, 2 replies; 3+ messages in thread
From: Yunjian Wang @ 2024-12-23 3:29 UTC (permalink / raw)
To: dev
Cc: maxime.coquelin, chenbox, cheng1.jiang, jerry.lilijun,
Yunjian Wang, stable
The descriptor chains length must be greater than the Virtio-net
header size. Otherwise, such descriptor chains sizes implies no
packet data.
Fixes: fe8477ebbd94 ("vhost: support async packed ring dequeue")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
lib/vhost/virtio_net.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index 69901ab3b5..8fc9bfa056 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -3962,6 +3962,16 @@ virtio_dev_tx_async_single_packed(struct virtio_net *dev,
VHOST_ACCESS_RO) < 0))
return -1;
+ if (unlikely(buf_len <= dev->vhost_hlen)) {
+ if (!allocerr_warned) {
+ VHOST_DATA_LOG(dev->ifname, ERR, "Invalid buffer length.");
+ allocerr_warned = true;
+ }
+ return -1;
+ }
+
+ buf_len -= dev->vhost_hlen;
+
if (unlikely(virtio_dev_pktmbuf_prep(dev, pkts, buf_len))) {
if (!allocerr_warned) {
VHOST_DATA_LOG(dev->ifname, ERR, "Failed mbuf alloc of size %d from %s.",
--
2.33.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] vhost: fix missing descriptor chains length checks
2024-12-23 3:29 [PATCH 1/1] vhost: fix missing descriptor chains length checks Yunjian Wang
@ 2025-03-04 12:29 ` Maxime Coquelin
2025-03-04 13:42 ` Maxime Coquelin
1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2025-03-04 12:29 UTC (permalink / raw)
To: Yunjian Wang, dev; +Cc: chenbox, cheng1.jiang, jerry.lilijun, stable
On 12/23/24 4:29 AM, Yunjian Wang wrote:
> The descriptor chains length must be greater than the Virtio-net
> header size. Otherwise, such descriptor chains sizes implies no
> packet data.
>
> Fixes: fe8477ebbd94 ("vhost: support async packed ring dequeue")
> Cc: stable@dpdk.org
>
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
> lib/vhost/virtio_net.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
> index 69901ab3b5..8fc9bfa056 100644
> --- a/lib/vhost/virtio_net.c
> +++ b/lib/vhost/virtio_net.c
> @@ -3962,6 +3962,16 @@ virtio_dev_tx_async_single_packed(struct virtio_net *dev,
> VHOST_ACCESS_RO) < 0))
> return -1;
>
> + if (unlikely(buf_len <= dev->vhost_hlen)) {
> + if (!allocerr_warned) {
> + VHOST_DATA_LOG(dev->ifname, ERR, "Invalid buffer length.");
> + allocerr_warned = true;
> + }
> + return -1;
> + }
> +
> + buf_len -= dev->vhost_hlen;
> +
> if (unlikely(virtio_dev_pktmbuf_prep(dev, pkts, buf_len))) {
> if (!allocerr_warned) {
> VHOST_DATA_LOG(dev->ifname, ERR, "Failed mbuf alloc of size %d from %s.",
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] vhost: fix missing descriptor chains length checks
2024-12-23 3:29 [PATCH 1/1] vhost: fix missing descriptor chains length checks Yunjian Wang
2025-03-04 12:29 ` Maxime Coquelin
@ 2025-03-04 13:42 ` Maxime Coquelin
1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2025-03-04 13:42 UTC (permalink / raw)
To: Yunjian Wang, dev; +Cc: chenbox, cheng1.jiang, jerry.lilijun, stable
On 12/23/24 4:29 AM, Yunjian Wang wrote:
> The descriptor chains length must be greater than the Virtio-net
> header size. Otherwise, such descriptor chains sizes implies no
> packet data.
>
> Fixes: fe8477ebbd94 ("vhost: support async packed ring dequeue")
> Cc: stable@dpdk.org
>
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
> lib/vhost/virtio_net.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
Applied to next-virtio.
Thanks,
Maxime
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-04 13:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-23 3:29 [PATCH 1/1] vhost: fix missing descriptor chains length checks Yunjian Wang
2025-03-04 12:29 ` Maxime Coquelin
2025-03-04 13:42 ` Maxime Coquelin
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).