From patchwork Thu Jan 17 11:20:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Toshiaki Makita X-Patchwork-Id: 1026544 Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lab.ntt.co.jp Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43gM9n2kVrz9sCX for ; Thu, 17 Jan 2019 22:22:21 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726593AbfAQLWT (ORCPT ); Thu, 17 Jan 2019 06:22:19 -0500 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]:37797 "EHLO tama500.ecl.ntt.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725889AbfAQLWT (ORCPT ); Thu, 17 Jan 2019 06:22:19 -0500 Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id x0HBM8lU015952; Thu, 17 Jan 2019 20:22:08 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 5D94B639311; Thu, 17 Jan 2019 20:22:08 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 50640639309; Thu, 17 Jan 2019 20:22:08 +0900 (JST) Received: from makita-ubuntu.m.ecl.ntt.co.jp (unknown [129.60.241.182]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id 444A0400B79; Thu, 17 Jan 2019 20:22:08 +0900 (JST) From: Toshiaki Makita Subject: [PATCH net 0/7] virtio_net: Fix problems around XDP tx and napi_tx Date: Thu, 17 Jan 2019 20:20:38 +0900 Message-Id: <1547724045-2726-1-git-send-email-makita.toshiaki@lab.ntt.co.jp> X-Mailer: git-send-email 2.7.4 X-CC-Mail-RelayStamp: 1 To: "David S. Miller" , "Michael S. Tsirkin" , Jason Wang Cc: Toshiaki Makita , netdev@vger.kernel.org, virtualization@lists.linux-foundation.org, Willem de Bruijn , Jesper Dangaard Brouer X-TM-AS-MML: disable Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org While I'm looking into how to account standard tx counters on XDP tx processing, I found several bugs around XDP tx and napi_tx. Patch1: Fix oops on error path. Patch2 depends on this. Patch2: Fix memory corruption on freeing xdp_frames with napi_tx enabled. Patch3: Minor fix patch5 depends on. Patch4: Fix memory corruption on processing xdp_frames when XDP is disabled. Also patch5 depends on this. Patch5: Fix memory corruption on processing xdp_frames while XDP is being disabled. Patch6: Minor fix patch7 depends on. Patch7: Fix memory corruption on freeing sk_buff or xdp_frames when a normal queue is reused for XDP and vise versa. Signed-off-by: Toshiaki Makita Toshiaki Makita (7): virtio_net: Don't enable NAPI when interface is down virtio_net: Don't call free_old_xmit_skbs for xdp_frames virtio_net: Fix not restoring real_num_rx_queues virtio_net: Fix out of bounds access of sq virtio_net: Don't process redirected XDP frames when XDP is disabled virtio_net: Use xdp_return_frame to free xdp_frames on destroying vqs virtio_net: Differentiate sk_buff and xdp_frame on freeing drivers/net/virtio_net.c | 154 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 109 insertions(+), 45 deletions(-) Acked-by: Michael S. Tsirkin