Thread (12 messages) 12 messages, 4 authors, 2018-03-09

Re: [PATCH] vhost_net: initialize rx_ring in vhost_net_open()

flat view

From: Alexander Potapenko <glider@google.com>
Date: 2018-03-08 15:20:51

On Thu, Mar 8, 2018 at 4:15 PM, Eric Dumazet [off-list ref] wrote:

On 03/08/2018 05:37 AM, Alexander Potapenko wrote:
quoted
KMSAN reported a use of uninit memory in vhost_net_buf_unproduce()
while trying to access n->vqs[VHOST_NET_VQ_TX].rx_ring:


==================================================================

Signed-off-by: Alexander Potapenko <glider@google.com>

Please identify bug origin with a Fixes: tag
Fixes: 5990a30510ed1 ("tun/tap: use ptr_ring instead of skb_array")

The above patch introduced rx_ring, but the problem existed before.
This will tremendously help stable teams that are struggling with many
backports these days.

Thanks.

quoted
---
  drivers/vhost/net.c | 1 +
  1 file changed, 1 insertion(+)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 610cba276d47..60f1080bffc7 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -948,6 +948,7 @@ static int vhost_net_open(struct inode *inode, struct
file *f)
                n->vqs[i].done_idx = 0;
                n->vqs[i].vhost_hlen = 0;
                n->vqs[i].sock_hlen = 0;
+               n->vqs[i].rx_ring = NULL;
                vhost_net_buf_init(&n->vqs[i].rxq);
        }
        vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX);


-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help