-----Original Message-----Now no problem has been found yet, and I found it when reviewing the code.
From: Jason Wang [mailto:jasowang@xxxxxxxxxx]
Sent: Monday, December 04, 2017 3:10 PM
To: wangyunjian <wangyunjian@xxxxxxxxxx>; linux-
kernel@xxxxxxxxxxxxxxx
Cc: mst@xxxxxxxxxx; caihe <caihe@xxxxxxxxxx>
Subject: Re: [PATCH net] virtio_net: fix return value check in
receive_mergeable()
On 2017å12æ04æ 14:02, wangyunjian wrote:
From: Yunjian Wang <wangyunjian@xxxxxxxxxx>net_device *dev,
The function virtqueue_get_buf_ctx() could return NULL, the return
value 'buf' need to be checked with NULL, not value 'ctx'.
Signed-off-by: Yunjian Wang <wangyunjian@xxxxxxxxxx>
---
drivers/net/virtio_net.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 19a985e..559b215 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -756,7 +756,7 @@ static struct sk_buff *receive_mergeable(struct
int num_skb_frags;missing\n",
buf = virtqueue_get_buf_ctx(rq->vq, &len, &ctx);
- if (unlikely(!ctx)) {
+ if (unlikely(!buf)) {
pr_debug("%s: rx error: %d buffers out of %d
dev->name, num_buf,Hi:
virtio16_to_cpu(vi->vdev,
The path looks good but I'm not sure this is a real fix since we add
data and ctx simultaneously in virtqueue_add_inbuf_ctx().
Any bad result you see without this patch?
Thanks
Thanks