virtio_net: fix missing lock protection on control_buf access
authorHeng Qi <hengqi@linux.alibaba.com>
Thu, 30 May 2024 03:41:43 +0000 (11:41 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 1 Jun 2024 22:09:56 +0000 (15:09 -0700)
commit30636258a7c9174be44ddb2318bae4f66d4beab0
treec6964b3e271e41aa3ad30ac3492c4e5a112254ee
parentd8ec19857b095b39d114ae299713bd8ea6c1e66a
virtio_net: fix missing lock protection on control_buf access

Refactored the handling of control_buf to be within the cvq_lock
critical section, mitigating race conditions between reading device
responses and new command submissions.

Fixes: 6f45ab3e0409 ("virtio_net: Add a lock for the command VQ.")
Signed-off-by: Heng Qi <hengqi@linux.alibaba.com>
Reviewed-by: Hariprasad Kelam <hkelam@marvell.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240530034143.19579-1-hengqi@linux.alibaba.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/virtio_net.c