Skip to contentSkip to conversation

net/virtio: fix virtio_net_hdr not being cleared correctly

PATCH New javin 1 participant 1 message Aug 13, 2020 Network drivers

lore
Share & tools
lore

javin

author
#0 lore raw

PATCH 1/1 net/virtio: fix virtio_net_hdr not being cleared correctly

The macro ASSIGN_UNLESS_EQUAL doesn't assign value to the variable, so the virtio_net_hdr may not be cleared correctly and the tx packet may be droped due to wrong virtio_net_hdr.

Fixes 57f90f894588 ("net/virtio: reuse packed ring functions")
---
 drivers/net/virtio/virtqueue.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtqueue.h +1 -1
index 105a9c00c..e94d78ae5 100644
@@ -610,7 +610,7 @@ virtqueue_notify(struct virtqueue *vq)
 	typeof(var) var_ = (var);		\
 	typeof(val) val_ = (val);		\
 	if ((var_) != (val_))			\
-		(var_) = (val_);		\
+		(var) = (val_);		\
 } while (0)
 
 #define virtqueue_clear_net_hdr(hdr) do {		\
Signature · 1 line
2.17.1