From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 48E14EB64D9 for ; Thu, 15 Jun 2023 15:02:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id CA1F9400D8; Thu, 15 Jun 2023 15:02:29 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org CA1F9400D8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1686841349; bh=MP/wpTkLZfOffY7PJxAWTm5drTuT7KJ79sG0y8Bfnjk=; h=From:Date:To:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Cc:From; b=S7TrIvLTQv+UaRNu2oB1vVsg1XqpqiJWZ4HuQK+aL3xEtY8d1fX42H3k9jCrBExCq n1r8mwSN2r0nLSs1ayoT8wX/nhfSVQzmsFoV6JMM0PtNwi/b62fplhk44VXjNVNG6C QttCH9LfUaNEHrLIyiPr8gUVGkgN6RrTAy4cKV2s3wCVd4MqUaD1fFi0kKdM7pMVIT xaQHzTA2PBTMofBjf1BD4oKvobQP4zAlv1XZVAL/eu5bCVkAQbmGQpkR+Fv9BNtZxJ wgSUoeAoysdGaQRxxLqmiJVG/ETkJMHCemUkaWgOl8hRqJqTkIAqMOBztpWotYNZxo sutWdqb6DIoqA== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9XHou8Ie38SV; Thu, 15 Jun 2023 15:02:29 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id CD6354193D; Thu, 15 Jun 2023 15:02:28 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org CD6354193D Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 645401BF32A for ; Thu, 15 Jun 2023 09:46:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 3A90641F56 for ; Thu, 15 Jun 2023 09:46:00 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 3A90641F56 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t3g7txHdn-9m for ; Thu, 15 Jun 2023 09:45:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 5B46641F51 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by smtp4.osuosl.org (Postfix) with ESMTPS id 5B46641F51 for ; Thu, 15 Jun 2023 09:45:58 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0537261BED; Thu, 15 Jun 2023 09:45:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF640C433C8; Thu, 15 Jun 2023 09:45:53 +0000 (UTC) From: Simon Horman Date: Thu, 15 Jun 2023 11:45:36 +0200 MIME-Version: 1.0 Message-Id: <20230615-igc-err-ptr-v1-1-a17145eb8d62@kernel.org> X-B4-Tracking: v=1; b=H4sIAL/dimQC/x2NwQrCQAwFf2XJ2cB2pSJeBT/Aq3jYpq9toKwlW 0Uo/XeDxxkYZqMKU1S6hI0MH636Kg7NIZBMuYxg7Z0pxXSMp6ZlHYVhxstq3AKDIMm5j5m86HI Fd5aLTN6U9zy7XAyDfv+LB91v11Cw0nPffyFv31Z7AAAA To: Jesse Brandeburg , Tony Nguyen X-Mailer: b4 0.12.2 X-Mailman-Approved-At: Thu, 15 Jun 2023 15:02:27 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686822357; bh=VXmgec0SvoWNjD+zQJUGR2dz0bJtpAmkZ85WuhMZ1Vk=; h=From:Date:Subject:To:Cc:From; b=ul02Ap/uEzBhWv5cvpcsaJ49I13Y8VZvNH5Lz1HvhDCmylTKEAaFsm2M3XlB7l1E7 D9qWbeZtCI77KdL8iMwRa2zC26kh7u8TiVOK9Ja0OmiVBFdOemN/3NNEKpPigwEE8W c96Vto88G0n29VaVkOeWa5A/KfqIZy7+ZM5/ZkWwVNuoryumL7+mHaAS/+swfQECKv HdXS+ZbvFgplp//3I6dI0sGR54dkLMw/6hZuYIQtCe4SvHO9ThGbRNYXmJM6OUQMVM u/NQIweyXo9T0lWOtT/+xoUjwIIQTNZ9FsVhd7WxrIGSpCZp2q5nkvueUoo0WjRCnP EqWj4wLbDtf+Q== X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=ul02Ap/u Subject: [Intel-wired-lan] [PATCH RFC net] igc: Avoid dereference of ptr_err in igc_clean_rx_irq() X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andre Guedes , Jesper Dangaard Brouer , Daniel Borkmann , Jithu Joseph , netdev@vger.kernel.org, John Fastabend , Alexei Starovoitov , Eric Dumazet , intel-wired-lan@lists.osuosl.org, Vedang Patel , Jakub Kicinski , bpf@vger.kernel.org, Paolo Abeni , "David S. Miller" , Dan Carpenter Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" In igc_clean_rx_irq() the result of a call to igc_xdp_run_prog() is assigned to the skb local variable. This may be an ERR_PTR. A little later the following is executed, which seems to be a possible dereference of an ERR_PTR. total_bytes += skb->len; Avoid this problem by continuing the loop in which all of the above occurs once the handling of the NULL case completes. This proposed fix is speculative - I do not have deep knowledge of this driver. And I am concerned about the effect of skipping the following logic: igc_put_rx_buffer(rx_ring, rx_buffer, rx_buffer_pgcnt); cleaned_count++; Flagged by Smatch as: .../igc_main.c:2467 igc_xdp_run_prog() warn: passing zero to 'ERR_PTR' Compile tested only. Fixes: 26575105d6ed ("igc: Add initial XDP support") Signed-off-by: Simon Horman --- drivers/net/ethernet/intel/igc/igc_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 88145c30c919..b58c8a674bd1 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -2586,6 +2586,7 @@ static int igc_clean_rx_irq(struct igc_q_vector *q_vector, const int budget) total_packets++; total_bytes += size; + continue; } else if (skb) igc_add_rx_frag(rx_ring, rx_buffer, skb, size); else if (ring_uses_build_skb(rx_ring)) _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan