From patchwork Mon Mar 17 10:15:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Meghana Malladi X-Patchwork-Id: 14018948 X-Patchwork-Delegate: kuba@kernel.org Received: from lelvem-ot01.ext.ti.com (lelvem-ot01.ext.ti.com [198.47.23.234]) (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 06D0F2356C7; Mon, 17 Mar 2025 10:16:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.234 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206598; cv=none; b=flfkhgsSF1lqwT05NBV4DrFes+Tj2GI/Xj+GZVpA+iMQgmJ+h08dBY8SrusorV9po7gReeo8h7M6QhkpJphrs8Y331CZwDODMD9gu/t8Mr+dE/MA1ZXCk8ufOlGWQswAHEWRO8MUO0TqcSqwyuFnjoFAJOG8Tt1yGXVS3QmCmYo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206598; c=relaxed/simple; bh=mtP5Hn6WkKw7ux+XtFQQDuxuhg0ahHYMIHGpq6J4U0g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TAVGQ84JCbJLclryJ5xtb6kCQRNYYoseNUkViXfNM6EWXa3ilSRMW7Bz6vGOsGbLRk5ATfOEuL6C1yF1AUYJ2/cM9nwdj4IsxqrDSWkE4HRn9JTIRdOKCEo8YrWmmX/4V0xROrE7WDiAAKkoke3QiFCfyatWodSFrly9Kl4RKjA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=dVlZgp1F; arc=none smtp.client-ip=198.47.23.234 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="dVlZgp1F" Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelvem-ot01.ext.ti.com (8.15.2/8.15.2) with ESMTPS id 52HAG1Gk2309530 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Mar 2025 05:16:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1742206561; bh=sTDlmrlfDarhnmJUwkBsi6LCYHQ5yg7dmc8Vf59HSdg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=dVlZgp1FytDJf7yBi/4W0HE4DAB/Ndq1YXWxzx74fcXp9IrT7mLYY65hU5JlGjrCL IQF5W+IX/jJgxoivbGRMBs7aWLgZFMjGyywJiDN6kPSNqS4sLyJdScF9/vmyzzMNad YqO8FIsGqjzVKPr07v68+F3GXh8yDyEmkgzWx9gM= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 52HAG16u000389 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 17 Mar 2025 05:16:01 -0500 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 17 Mar 2025 05:16:00 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 17 Mar 2025 05:16:00 -0500 Received: from lelv0854.itg.ti.com (lelv0854.itg.ti.com [10.181.64.140]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 52HAG041036292; Mon, 17 Mar 2025 05:16:00 -0500 Received: from localhost (meghana-pc.dhcp.ti.com [10.24.69.13] (may be forged)) by lelv0854.itg.ti.com (8.14.7/8.14.7) with ESMTP id 52HAG0bF019287; Mon, 17 Mar 2025 05:16:00 -0500 From: Meghana Malladi To: , , , , CC: , , , , , , , , , , , , , , , Vignesh Raghavendra , Roger Quadros , Subject: [PATCH net-next 1/3] net: ti: prueth: Fix kernel warning while bringing down network interface Date: Mon, 17 Mar 2025 15:45:48 +0530 Message-ID: <20250317101551.1005706-2-m-malladi@ti.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250317101551.1005706-1-m-malladi@ti.com> References: <20250317101551.1005706-1-m-malladi@ti.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-Patchwork-Delegate: kuba@kernel.org During network interface initialization, the NIC driver needs to register its Rx queue with the XDP, to ensure the incoming XDP buffer carries a pointer reference to this info and is stored inside xdp_rxq_info. While this struct isn't tied to XDP prog, if there are any changes in Rx queue, the NIC driver needs to stop the Rx queue by unregistering with XDP before purging and reallocating memory. Drop page_pool destroy during Rx channel reset and this is already handled by XDP during xdp_rxq_info_unreg (Rx queue unregister), failing to do will cause the following warning: [ 271.494611] ------------[ cut here ]------------ [ 271.494629] WARNING: CPU: 0 PID: 2453 at /net/core/page_pool.c:1108 0xffff8000808d5f60 Fixes: 46eeb90f03e0 ("net: ti: icssg-prueth: Use page_pool API for RX buffer allocation") Signed-off-by: Meghana Malladi --- drivers/net/ethernet/ti/icssg/icssg_common.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/ethernet/ti/icssg/icssg_common.c b/drivers/net/ethernet/ti/icssg/icssg_common.c index df5da7a98abf..afa01c22dee8 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_common.c +++ b/drivers/net/ethernet/ti/icssg/icssg_common.c @@ -1216,9 +1216,6 @@ void prueth_reset_rx_chan(struct prueth_rx_chn *chn, prueth_rx_cleanup, !!i); if (disable) k3_udma_glue_disable_rx_chn(chn->rx_chn); - - page_pool_destroy(chn->pg_pool); - chn->pg_pool = NULL; } EXPORT_SYMBOL_GPL(prueth_reset_rx_chan); From patchwork Mon Mar 17 10:15:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Meghana Malladi X-Patchwork-Id: 14018947 X-Patchwork-Delegate: kuba@kernel.org Received: from lelvem-ot01.ext.ti.com (lelvem-ot01.ext.ti.com [198.47.23.234]) (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 06C7E2356C5; Mon, 17 Mar 2025 10:16:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.234 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206597; cv=none; b=jONKua8cRaRRPQ8blXMWuoMbJQCAWZJ32gzdQD4t5v3XpsGakiksb4hzH3vaLaFy6sEgW9EqDVTh0AEbD9aIHPT7EfMx/m86YecBA0eyM4J8DsnZ+oS2XeVP+0DGtD6bH38Uqwr3IdeMnCqq5w21sgSPAkWR/5NOzWfw0hzC8+c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206597; c=relaxed/simple; bh=K34Aj+25gMhXmyalVQZpEdDh7YbkL+mgpz53TLbOa0w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AQWE5Gd6S3dMcsUiHXSX0iS8bzZVcrTjPrdHysfwIrESe07hSP9Ef4TmSFqiO+xro0agID7phxbCK7aC1gtKJtEEO3hHLIFY31NSBnzYtxYibB0fup5fAAdHkgwrcghbC9NYPCWP4kIyVCJRxfVORKxyPC6C7bui6tzr4+EwGKs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=GW7wqvAe; arc=none smtp.client-ip=198.47.23.234 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="GW7wqvAe" Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelvem-ot01.ext.ti.com (8.15.2/8.15.2) with ESMTPS id 52HAG4rG2309540 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Mar 2025 05:16:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1742206564; bh=OwguXbm0nOXrCmblsRIEMJtiGJGpKRrpwqdfvSa1Xx8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=GW7wqvAeINklNQH9pjjztnXgVus4pzmC8UrBvquxECc8qJazAn12MQBSF1JYomnSK Ad1/ub7lxGPgKLNFAmUXEBYfylMvC9cbegyQUcqMj910bK838DtGH7usobd943NAAo BmTKUNBjTxUBPiFLXlRdDNBE5SDzCYOWyNeZ1OWA= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 52HAG4JM049932 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 17 Mar 2025 05:16:04 -0500 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 17 Mar 2025 05:16:03 -0500 Received: from fllvsmtp7.itg.ti.com (10.64.40.31) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 17 Mar 2025 05:16:04 -0500 Received: from lelv0854.itg.ti.com (lelv0854.itg.ti.com [10.181.64.140]) by fllvsmtp7.itg.ti.com (8.15.2/8.15.2) with ESMTP id 52HAG3GQ075275; Mon, 17 Mar 2025 05:16:03 -0500 Received: from localhost (meghana-pc.dhcp.ti.com [10.24.69.13] (may be forged)) by lelv0854.itg.ti.com (8.14.7/8.14.7) with ESMTP id 52HAG353019296; Mon, 17 Mar 2025 05:16:03 -0500 From: Meghana Malladi To: , , , , CC: , , , , , , , , , , , , , , , Vignesh Raghavendra , Roger Quadros , Subject: [PATCH net-next 2/3] net: ti: prueth: Fix possible NULL pointer dereference inside emac_xmit_xdp_frame() Date: Mon, 17 Mar 2025 15:45:49 +0530 Message-ID: <20250317101551.1005706-3-m-malladi@ti.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250317101551.1005706-1-m-malladi@ti.com> References: <20250317101551.1005706-1-m-malladi@ti.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-Patchwork-Delegate: kuba@kernel.org There is an error check inside emac_xmit_xdp_frame() function which is called when the driver wants to transmit XDP frame, to check if the allocated tx descriptor is NULL, if true to exit and return ICSSG_XDP_CONSUMED implying failure in transmission. In this case trying to free a descriptor which is NULL will result in kernel crash due to NULL pointer dereference. Fix this error handling and increase netdev tx_dropped stats in the caller of this function if the function returns ICSSG_XDP_CONSUMED. Fixes: 62aa3246f462 ("net: ti: icssg-prueth: Add XDP support") Signed-off-by: Meghana Malladi --- drivers/net/ethernet/ti/icssg/icssg_common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ti/icssg/icssg_common.c b/drivers/net/ethernet/ti/icssg/icssg_common.c index afa01c22dee8..f0224576b95f 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_common.c +++ b/drivers/net/ethernet/ti/icssg/icssg_common.c @@ -584,7 +584,7 @@ u32 emac_xmit_xdp_frame(struct prueth_emac *emac, first_desc = k3_cppi_desc_pool_alloc(tx_chn->desc_pool); if (!first_desc) { netdev_dbg(ndev, "xdp tx: failed to allocate descriptor\n"); - goto drop_free_descs; /* drop */ + return ICSSG_XDP_CONSUMED; /* drop */ } if (page) { /* already DMA mapped by page_pool */ @@ -672,8 +672,10 @@ static u32 emac_run_xdp(struct prueth_emac *emac, struct xdp_buff *xdp, q_idx = smp_processor_id() % emac->tx_ch_num; result = emac_xmit_xdp_frame(emac, xdpf, page, q_idx); - if (result == ICSSG_XDP_CONSUMED) + if (result == ICSSG_XDP_CONSUMED) { + ndev->stats.tx_dropped++; goto drop; + } dev_sw_netstats_rx_add(ndev, xdpf->len); return result; From patchwork Mon Mar 17 10:15:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Meghana Malladi X-Patchwork-Id: 14018946 X-Patchwork-Delegate: kuba@kernel.org Received: from fllvem-ot03.ext.ti.com (fllvem-ot03.ext.ti.com [198.47.19.245]) (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 248272356B2; Mon, 17 Mar 2025 10:16:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.245 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206596; cv=none; b=GYQu/4jqLxYFMTTt2uA81XmoZ0VhwJzjljEYvrNk7wN4m5B8O7E+axwTi0O9uQaGyEnzkfekkYM4oS/sH4fCASWs6mGBJcm5b3ds7M5ZVJNftE218tYdxMsrBnm+0g88CG7xNU9Zx7nP0ast4K4tSrb5GV1wgb2ukPe7xyFQ8Rs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206596; c=relaxed/simple; bh=S0GYBPYA7v9UVdWEygHJSQYpaSclunqfmwnymxYze50=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=i9jmkLIgHavYZm7QAalgxTCFdTlR49rL5+XgdpYozVPM0RoqajF1FyVMV7qAp8NyupE7Q3U34FGAt1/KFQQZjiWrhmg38sr5VAuDEnlQ4Wq23u38tNNcmn16HseIgJYOdR6jbMRFvyK5lFIpywSAPTIgObYC1a4DeVx4YoCmp3s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=l7TxtPXe; arc=none smtp.client-ip=198.47.19.245 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="l7TxtPXe" Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllvem-ot03.ext.ti.com (8.15.2/8.15.2) with ESMTPS id 52HAG7sZ2248072 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Mar 2025 05:16:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1742206567; bh=BH5+4XXFN9MnV7T9lfahZWTvXJLBFXDIHb5Miv6+HGM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=l7TxtPXeVecfVCEodrxntREiLHgSdZQK7Qrm4CXmNynRdIs26O95TkRCtZ/ceRyPn SyWNGAo5RLOKe0hlU1yz29Gkwc99Kfu12NqbOrs+co4EiZkh1Ro9qhQf5vnhj0rlW2 BseF7gIlJHU76s1fdsjO80QSA0cEjkmUP+MO1npY= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 52HAG7e6000531 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 17 Mar 2025 05:16:07 -0500 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 17 Mar 2025 05:16:06 -0500 Received: from fllvsmtp7.itg.ti.com (10.64.40.31) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 17 Mar 2025 05:16:06 -0500 Received: from lelv0854.itg.ti.com (lelv0854.itg.ti.com [10.181.64.140]) by fllvsmtp7.itg.ti.com (8.15.2/8.15.2) with ESMTP id 52HAG6Is075321; Mon, 17 Mar 2025 05:16:06 -0500 Received: from localhost (meghana-pc.dhcp.ti.com [10.24.69.13] (may be forged)) by lelv0854.itg.ti.com (8.14.7/8.14.7) with ESMTP id 52HAG5Lj019302; Mon, 17 Mar 2025 05:16:06 -0500 From: Meghana Malladi To: , , , , CC: , , , , , , , , , , , , , , , Vignesh Raghavendra , Roger Quadros , Subject: [PATCH net-next 3/3] net: ti: icss-iep: Fix possible NULL pointer dereference for perout request Date: Mon, 17 Mar 2025 15:45:50 +0530 Message-ID: <20250317101551.1005706-4-m-malladi@ti.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250317101551.1005706-1-m-malladi@ti.com> References: <20250317101551.1005706-1-m-malladi@ti.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-Patchwork-Delegate: kuba@kernel.org Whenever there is a perout request from the user application, kernel receives req structure containing the configuration info for that req. Add NULL pointer handling for perout request if that req struct points to NULL. Fixes: e5b456a14215 ("net: ti: icss-iep: Add pwidth configuration for perout signal") Signed-off-by: Meghana Malladi --- drivers/net/ethernet/ti/icssg/icss_iep.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/ti/icssg/icss_iep.c b/drivers/net/ethernet/ti/icssg/icss_iep.c index b4a34c57b7b4..aeebdc4c121e 100644 --- a/drivers/net/ethernet/ti/icssg/icss_iep.c +++ b/drivers/net/ethernet/ti/icssg/icss_iep.c @@ -498,6 +498,10 @@ static int icss_iep_perout_enable(struct icss_iep *iep, { int ret = 0; + /* Return error if the req is NULL */ + if (!req) + return -EINVAL; + /* Reject requests with unsupported flags */ if (req->flags & ~(PTP_PEROUT_DUTY_CYCLE | PTP_PEROUT_PHASE))