netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] vhost_net: don't continue to call the recvmsg when meet errors
@ 2016-11-30 12:10 Yunjian Wang
  2016-11-30 13:07 ` Jason Wang
  2016-11-30 13:40 ` Michael S. Tsirkin
  0 siblings, 2 replies; 13+ messages in thread
From: Yunjian Wang @ 2016-11-30 12:10 UTC (permalink / raw)
  To: mst, jasowang, netdev, linux-kernel; +Cc: caihe, wangyunjian

When we meet an error(err=-EBADFD) recvmsg, the error handling in vhost
handle_rx() will continue. This will cause a soft CPU lockup in vhost thread.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/vhost/net.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 5dc128a..edc470b 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -717,6 +717,9 @@ static void handle_rx(struct vhost_net *net)
 			pr_debug("Discarded rx packet: "
 				 " len %d, expected %zd\n", err, sock_len);
 			vhost_discard_vq_desc(vq, headcount);
+			/* Don't continue to do, when meet errors. */
+			if (err < 0)
+				goto out;
 			continue;
 		}
 		/* Supply virtio_net_hdr if VHOST_NET_F_VIRTIO_NET_HDR */
-- 
1.9.5.msysgit.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-12-01  4:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-30 12:10 [PATCH net] vhost_net: don't continue to call the recvmsg when meet errors Yunjian Wang
2016-11-30 13:07 ` Jason Wang
2016-11-30 13:43   ` Michael S. Tsirkin
2016-11-30 13:40 ` Michael S. Tsirkin
2016-12-01  2:48   ` wangyunjian
2016-12-01  3:13     ` Jason Wang
2016-12-01  3:21     ` Michael S. Tsirkin
2016-12-01  3:26       ` Jason Wang
2016-12-01  3:27         ` Michael S. Tsirkin
2016-12-01  3:37           ` Jason Wang
2016-12-01  4:41             ` wangyunjian
2016-12-01  4:56               ` Michael S. Tsirkin
2016-12-01  3:15   ` Jason Wang

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).