From patchwork Wed Apr 3 20:19:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13616646 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F246155736 for ; Wed, 3 Apr 2024 20:19:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712175580; cv=none; b=HBz61ZgRiwAdFir137e9PJt5EKHzqDLrUuIqFXBeo5kEQT2Aail/+Y1e7VWI64VtMZD5a/0iNiXjcXtXzZ6l8unGA4CKcdWDPFVErcwnAZckLKlS4ay8n+Shxe1pMapGFV2gP22SO4oabrA3rjcJVaG6IkcuUeHdqDkpxhj1luc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712175580; c=relaxed/simple; bh=bS7rex4W7tlbbeK1bDoaJcv/idXY63ZTKx6KFRI0KvA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tkOfP1lv65/iE+Omg2E1VMoys9TxF7BytAIrxd9UTKg5zmk7oDnQvUEWnq8SAlTvhLdxUNObt/Zu5b//tDkwx+Vh8ixax1CY8151WCva1nIt7+cGbXer0zxhJWhsjI8NJrCVabPTSVyqvRyjrMaX6vmRRkg9harvNSDaEAFC66w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=h9Q+8Tyj; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="h9Q+8Tyj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712175579; x=1743711579; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bS7rex4W7tlbbeK1bDoaJcv/idXY63ZTKx6KFRI0KvA=; b=h9Q+8TyjAyHx4p0zpqHEQkLmpP2ib0rmCmzGD/pNzh2P3K5SseNBBuxQ +kW5zDfPA3Ls4/POfdx7N20vAv9ruWZ+ZxjM/qTPckf5lQOh4FMcCCGC1 fjCt+ul1EdNH7sI8kw9TmU0fVUg6xoZ5hDrNPdrh/SOJF3GgLJ3xzkwf1 nMzO6evjjgAhMw2lGjkoUBVzWPw1+CSotQhBKeegd1UDxmBJfL/CnLQKM IWbKcMKm8b64uQ4S6+NKt++RbfvvJk0RC92/gXyFiKsDWsw+j4/v3Pxni 1u+hiYFDAK+7SnCf5xIj+nrqibqdwwG8z5pZVxBtZHaqrbpAF1GmHBtw9 g==; X-CSE-ConnectionGUID: 5bugoiZEQ0il510pfJGZJw== X-CSE-MsgGUID: 0opeHxvKSPG697ruNATLYQ== X-IronPort-AV: E=McAfee;i="6600,9927,11033"; a="18165800" X-IronPort-AV: E=Sophos;i="6.07,177,1708416000"; d="scan'208";a="18165800" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Apr 2024 13:19:37 -0700 X-CSE-ConnectionGUID: Wlx5iEguQDiWTHJ+ap12SQ== X-CSE-MsgGUID: 9AdsrIOdR6WHiKASHfR1kg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,177,1708416000"; d="scan'208";a="18662691" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by fmviesa008.fm.intel.com with ESMTP; 03 Apr 2024 13:19:36 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: Dan Carpenter , anthony.l.nguyen@intel.com, Jiri Pirko , Simon Horman Subject: [PATCH net 1/3] ice: Fix freeing uninitialized pointers Date: Wed, 3 Apr 2024 13:19:26 -0700 Message-ID: <20240403201929.1945116-2-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240403201929.1945116-1-anthony.l.nguyen@intel.com> References: <20240403201929.1945116-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Dan Carpenter Automatically cleaned up pointers need to be initialized before exiting their scope. In this case, they need to be initialized to NULL before any return statement. Fixes: 90f821d72e11 ("ice: avoid unnecessary devm_ usage") Signed-off-by: Dan Carpenter Reviewed-by: Jiri Pirko Reviewed-by: Simon Horman Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/ice/ice_common.c | 10 +++++----- drivers/net/ethernet/intel/ice/ice_ethtool.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c index db4b2844e1f7..d9f6cc71d900 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.c +++ b/drivers/net/ethernet/intel/ice/ice_common.c @@ -1002,8 +1002,8 @@ static void ice_get_itr_intrl_gran(struct ice_hw *hw) */ int ice_init_hw(struct ice_hw *hw) { - struct ice_aqc_get_phy_caps_data *pcaps __free(kfree); - void *mac_buf __free(kfree); + struct ice_aqc_get_phy_caps_data *pcaps __free(kfree) = NULL; + void *mac_buf __free(kfree) = NULL; u16 mac_buf_len; int status; @@ -3272,7 +3272,7 @@ int ice_update_link_info(struct ice_port_info *pi) return status; if (li->link_info & ICE_AQ_MEDIA_AVAILABLE) { - struct ice_aqc_get_phy_caps_data *pcaps __free(kfree); + struct ice_aqc_get_phy_caps_data *pcaps __free(kfree) = NULL; pcaps = kzalloc(sizeof(*pcaps), GFP_KERNEL); if (!pcaps) @@ -3420,7 +3420,7 @@ ice_cfg_phy_fc(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg, int ice_set_fc(struct ice_port_info *pi, u8 *aq_failures, bool ena_auto_link_update) { - struct ice_aqc_get_phy_caps_data *pcaps __free(kfree); + struct ice_aqc_get_phy_caps_data *pcaps __free(kfree) = NULL; struct ice_aqc_set_phy_cfg_data cfg = { 0 }; struct ice_hw *hw; int status; @@ -3561,7 +3561,7 @@ int ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg, enum ice_fec_mode fec) { - struct ice_aqc_get_phy_caps_data *pcaps __free(kfree); + struct ice_aqc_get_phy_caps_data *pcaps __free(kfree) = NULL; struct ice_hw *hw; int status; diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index 255a9c8151b4..78b833b3e1d7 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -941,11 +941,11 @@ static u64 ice_loopback_test(struct net_device *netdev) struct ice_netdev_priv *np = netdev_priv(netdev); struct ice_vsi *orig_vsi = np->vsi, *test_vsi; struct ice_pf *pf = orig_vsi->back; + u8 *tx_frame __free(kfree) = NULL; u8 broadcast[ETH_ALEN], ret = 0; int num_frames, valid_frames; struct ice_tx_ring *tx_ring; struct ice_rx_ring *rx_ring; - u8 *tx_frame __free(kfree); int i; netdev_info(netdev, "loopback test\n"); From patchwork Wed Apr 3 20:19:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13616647 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 371C115574B for ; Wed, 3 Apr 2024 20:19:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712175580; cv=none; b=bz2k5jwEh3DhmhkwcoyuUKnATu/Oe5VGo59qGheU9eqyTIXzyjFAhZYLBhwOD5QJVZEjojx9L1PcY2e1x1iMDG564pyn15/5ZlaClB8kUvzLvQZtgMoOb0g5oFGkTdYARLHc1iywmNwjt/8q0WpxA9/kgzNaZe67A/buhvyMbVk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712175580; c=relaxed/simple; bh=9H2lwI4Bsjuj+5xkt2aHUfOhrY/43BLjMOJ8ztq2o1c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PQ+1UBv+s2deP1wGGb7/UZ7nFobEhMcss1ZEZg9mH8C9O0HVhKx79OBDytD+P5Hlu8M1x3Va34rd/i9tU3ozH4zwLyqvMUjxrrTRdZQs+67eB+/uFYtu/9HUmFirY11R708YY+INAX9nxKhcl0GgDPK4545PTm1AymsAi/5q8IM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=JZyS4/Yw; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="JZyS4/Yw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712175579; x=1743711579; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9H2lwI4Bsjuj+5xkt2aHUfOhrY/43BLjMOJ8ztq2o1c=; b=JZyS4/YwCOHgQ9jLwDCkwI+LSWFTEd/3nc2m11DQsIN7fO4zH7tk04GP YC7qM5ByCC7eba7xG/nxE6hBDrd9cRUtpRonZJ21i+0mki086UZrc62aL cFsxiR2DDrnr8uYsUkp5CeVqiR/4jCAYpuIp9p4JbSgni+J3uvmae69H2 Fe40dv61YQ9T3f4KGxVkwMaZnNIFsAFdqMCLQK8gNXtGCvPvPTZR+dB9Q M1cIDoBJBQAsXOHkg6bz3o/Za3UxGSIFk10m2NGiA6vQ2G3xJzKiAyIMC FGdmqlwdv1/rCtxZ1tGNcCcpzQHi8hvnpjE/JWSs13omXFxlb3GDoghNy w==; X-CSE-ConnectionGUID: qwPn1mbYR8iJW75Naack1w== X-CSE-MsgGUID: w1We7ttOQ1qut3YsRoHNUw== X-IronPort-AV: E=McAfee;i="6600,9927,11033"; a="18165808" X-IronPort-AV: E=Sophos;i="6.07,177,1708416000"; d="scan'208";a="18165808" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Apr 2024 13:19:38 -0700 X-CSE-ConnectionGUID: nw3JSSvRTjWagZcvWP2BPQ== X-CSE-MsgGUID: bdGwvaixR3Khl7bAW4sitg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,177,1708416000"; d="scan'208";a="18662695" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by fmviesa008.fm.intel.com with ESMTP; 03 Apr 2024 13:19:37 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: Petr Oros , anthony.l.nguyen@intel.com, horms@kernel.org, Michal Swiatkowski , Rafal Romanowski Subject: [PATCH net 2/3] ice: fix enabling RX VLAN filtering Date: Wed, 3 Apr 2024 13:19:27 -0700 Message-ID: <20240403201929.1945116-3-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240403201929.1945116-1-anthony.l.nguyen@intel.com> References: <20240403201929.1945116-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Petr Oros ice_port_vlan_on/off() was introduced in commit 2946204b3fa8 ("ice: implement bridge port vlan"). But ice_port_vlan_on() incorrectly assigns ena_rx_filtering to inner_vlan_ops in DVM mode. This causes an error when rx_filtering cannot be enabled in legacy mode. Reproducer: echo 1 > /sys/class/net/$PF/device/sriov_numvfs ip link set $PF vf 0 spoofchk off trust on vlan 3 dmesg: ice 0000:41:00.0: failed to enable Rx VLAN filtering for VF 0 VSI 9 during VF rebuild, error -95 Fixes: 2946204b3fa8 ("ice: implement bridge port vlan") Signed-off-by: Petr Oros Reviewed-by: Michal Swiatkowski Tested-by: Rafal Romanowski Signed-off-by: Tony Nguyen --- .../ethernet/intel/ice/ice_vf_vsi_vlan_ops.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c b/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c index 80dc4bcdd3a4..b3e1bdcb80f8 100644 --- a/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c +++ b/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c @@ -26,24 +26,22 @@ static void ice_port_vlan_on(struct ice_vsi *vsi) struct ice_vsi_vlan_ops *vlan_ops; struct ice_pf *pf = vsi->back; - if (ice_is_dvm_ena(&pf->hw)) { - vlan_ops = &vsi->outer_vlan_ops; - - /* setup outer VLAN ops */ - vlan_ops->set_port_vlan = ice_vsi_set_outer_port_vlan; - vlan_ops->clear_port_vlan = ice_vsi_clear_outer_port_vlan; + /* setup inner VLAN ops */ + vlan_ops = &vsi->inner_vlan_ops; - /* setup inner VLAN ops */ - vlan_ops = &vsi->inner_vlan_ops; + if (ice_is_dvm_ena(&pf->hw)) { vlan_ops->add_vlan = noop_vlan_arg; vlan_ops->del_vlan = noop_vlan_arg; vlan_ops->ena_stripping = ice_vsi_ena_inner_stripping; vlan_ops->dis_stripping = ice_vsi_dis_inner_stripping; vlan_ops->ena_insertion = ice_vsi_ena_inner_insertion; vlan_ops->dis_insertion = ice_vsi_dis_inner_insertion; - } else { - vlan_ops = &vsi->inner_vlan_ops; + /* setup outer VLAN ops */ + vlan_ops = &vsi->outer_vlan_ops; + vlan_ops->set_port_vlan = ice_vsi_set_outer_port_vlan; + vlan_ops->clear_port_vlan = ice_vsi_clear_outer_port_vlan; + } else { vlan_ops->set_port_vlan = ice_vsi_set_inner_port_vlan; vlan_ops->clear_port_vlan = ice_vsi_clear_inner_port_vlan; } From patchwork Wed Apr 3 20:19:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13616648 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6992155A25 for ; Wed, 3 Apr 2024 20:19:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712175581; cv=none; b=Aj8jjlNPYNFm2X5mav1Ep89SFEoT8hGzatWwisDOxmncXmJAaeZYv9Z/zugS77x3S6AbE/UoTW7bC0VIfteBQYD8EiNtms1P3mi86dJvikGVwaeZe3g5wesQ4jI6cmVJT+/hCF9ygU9RD5TmO5JrlRu7/zQFWrwxDteKjNKPEcM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712175581; c=relaxed/simple; bh=hegHlUhBasKUMZObKcLkJqe/zOi+DJrgrHKeq2FG/SE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mFZIALNTSqi5TwhdpucxCj+UJymtKjCRnWFH4Jb3UcDZmgMT3n2G6/YzbnCM3Wh3FbRYZorYZz1FxTVnuzdWev7fiaNZOgexe+6bkmL+UFdZZshsKOE8FKRDWBoY3tGEO4D2pbylf8UrtCu2Kd6H7ihKvstZmoho0ks+WxIk2xA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=R9W9CZjG; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="R9W9CZjG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712175580; x=1743711580; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hegHlUhBasKUMZObKcLkJqe/zOi+DJrgrHKeq2FG/SE=; b=R9W9CZjGoCVTwKyuPUGnILzNT+M+5ZcXIGffX963oVZ+Vm3mKhNug/C1 R4jxFo4OGxZAvKV8KrO3YTufzBH/LxCixNbhrcote+aRUQ9WhUisWI2yZ 7jbzEpc5Virrl0rl2rzPlpskKKhc891p1edhNIGmNN68rBVrCsbvDAW0i O485MuFiSy5Bs+DIT42wIyZlGvLP2mUsLgSzDLTU+d28+ZmfeAu2wxcH9 4UpKVXsye04GBYjfM9TKPQCIiib4egotyF9esP5z4+Vz/uegxuXBfJRkY SQk8wZWw5hzCLuhlwcuGZt6CeOgIu8kZWCfHbowj8lSaeg7y446SvTZfa A==; X-CSE-ConnectionGUID: pRQ3Zx2ISum1dq2IJByOaw== X-CSE-MsgGUID: bumTY+8pQjGX1aEKsnb6/Q== X-IronPort-AV: E=McAfee;i="6600,9927,11033"; a="18165815" X-IronPort-AV: E=Sophos;i="6.07,177,1708416000"; d="scan'208";a="18165815" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Apr 2024 13:19:38 -0700 X-CSE-ConnectionGUID: S4QR8hmARO2slCFPSocE9w== X-CSE-MsgGUID: I80dzmceSG+G87y0fIuAjg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,177,1708416000"; d="scan'208";a="18662698" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by fmviesa008.fm.intel.com with ESMTP; 03 Apr 2024 13:19:37 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: Joshua Hay , anthony.l.nguyen@intel.com, willemb@google.com, Balazs Nemeth , Jesse Brandeburg , Przemek Kitszel , Salvatore Daniele , Pavan Kumar Linga , Krishneil Singh Subject: [PATCH net 3/3] idpf: fix kernel panic on unknown packet types Date: Wed, 3 Apr 2024 13:19:28 -0700 Message-ID: <20240403201929.1945116-4-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240403201929.1945116-1-anthony.l.nguyen@intel.com> References: <20240403201929.1945116-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Joshua Hay In the very rare case where a packet type is unknown to the driver, idpf_rx_process_skb_fields would return early without calling eth_type_trans to set the skb protocol / the network layer handler. This is especially problematic if tcpdump is running when such a packet is received, i.e. it would cause a kernel panic. Instead, call eth_type_trans for every single packet, even when the packet type is unknown. Fixes: 3a8845af66ed ("idpf: add RX splitq napi poll support") Reported-by: Balazs Nemeth Signed-off-by: Joshua Hay Reviewed-by: Jesse Brandeburg Reviewed-by: Przemek Kitszel Tested-by: Salvatore Daniele Signed-off-by: Pavan Kumar Linga Tested-by: Krishneil Singh Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c index 6dd7a66bb897..f5bc4a278074 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c @@ -2941,6 +2941,8 @@ static int idpf_rx_process_skb_fields(struct idpf_queue *rxq, rx_ptype = le16_get_bits(rx_desc->ptype_err_fflags0, VIRTCHNL2_RX_FLEX_DESC_ADV_PTYPE_M); + skb->protocol = eth_type_trans(skb, rxq->vport->netdev); + decoded = rxq->vport->rx_ptype_lkup[rx_ptype]; /* If we don't know the ptype we can't do anything else with it. Just * pass it up the stack as-is. @@ -2951,8 +2953,6 @@ static int idpf_rx_process_skb_fields(struct idpf_queue *rxq, /* process RSS/hash */ idpf_rx_hash(rxq, skb, rx_desc, &decoded); - skb->protocol = eth_type_trans(skb, rxq->vport->netdev); - if (le16_get_bits(rx_desc->hdrlen_flags, VIRTCHNL2_RX_FLEX_DESC_ADV_RSC_M)) return idpf_rx_rsc(rxq, skb, rx_desc, &decoded);