From patchwork Fri Mar 28 10:24:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Meghana Malladi X-Patchwork-Id: 14031840 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 91CE0C28B20 for ; Fri, 28 Mar 2025 10:28:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WzSH/o0yISBtN/3+MZcetAOZsEZpTvcCbzXAjwOkb8Q=; b=MEu9S3OrvXq5fXmkcuIUtj8PiR VogBlYmkmScGuOkee5ixPb3tSwRvcq3aTuZmJl1lnH0yMELLN4bShxB2viY3qNnTWhtxwkxWS+Cc0 R8e/F65NBMpxHvsKlZN5q5V5LePabk5Nb5FIYy/e+sCY/WmtbT9aUskpnRLfIcjlBEN5Qoogxl088 8DpSgkCz3r81HPTwNofSRDtwjTk8E0zAWAvoWnUtcMAd5CruC1A4FVrkXDQwLAf/gLZhtF9U4GmdD 6/X/g5c0mHbgjgd8CWHgdBVmibb7TNBlsBse7uJ0JPgaCsDYRB0V7k1VzaUq7riWrJQLtnJo5UjTH IAxkjxig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1ty6ww-0000000D8Ei-2IER; Fri, 28 Mar 2025 10:28:30 +0000 Received: from lelvem-ot01.ext.ti.com ([198.47.23.234]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1ty6tC-0000000D7TD-3n3x for linux-arm-kernel@lists.infradead.org; Fri, 28 Mar 2025 10:24:40 +0000 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelvem-ot01.ext.ti.com (8.15.2/8.15.2) with ESMTPS id 52SAOBEY2125516 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 28 Mar 2025 05:24:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1743157451; bh=WzSH/o0yISBtN/3+MZcetAOZsEZpTvcCbzXAjwOkb8Q=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=gsGV9xaAHMmPy1rHi1dOhCeZf0FE7F+3XKD2NykL5ccYevwcPWBR+9GToP5hK7M8d G1hmiYmginzjO83ypN57ryTPqRYDDoyfk8y7MnUsIxCAPKuad5dQDjdEQ9+r+xn8C3 O9EUSdLsDqSJiRp35M7YbyLKJaeUTJm+Cyxag3ZI= Received: from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTP id 52SAOB4H079346; Fri, 28 Mar 2025 05:24:11 -0500 Received: from DLEE113.ent.ti.com (157.170.170.24) 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; Fri, 28 Mar 2025 05:24:11 -0500 Received: from fllvsmtp8.itg.ti.com (10.64.41.158) 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; Fri, 28 Mar 2025 05:24:11 -0500 Received: from fllv0122.itg.ti.com (fllv0122.itg.ti.com [10.247.120.72]) by fllvsmtp8.itg.ti.com (8.15.2/8.15.2) with ESMTP id 52SAOAAv080265; Fri, 28 Mar 2025 05:24:10 -0500 Received: from localhost (meghana-pc.dhcp.ti.com [10.24.69.13] (may be forged)) by fllv0122.itg.ti.com (8.14.7/8.14.7) with ESMTP id 52SAO9gB024929; Fri, 28 Mar 2025 05:24:10 -0500 From: Meghana Malladi To: , , , , , CC: , , , , , , , , , , , , , , , Vignesh Raghavendra , Roger Quadros , Subject: [PATCH net v3 1/3] net: ti: icssg-prueth: Fix kernel warning while bringing down network interface Date: Fri, 28 Mar 2025 15:54:01 +0530 Message-ID: <20250328102403.2626974-2-m-malladi@ti.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250328102403.2626974-1-m-malladi@ti.com> References: <20250328102403.2626974-1-m-malladi@ti.com> MIME-Version: 1.0 X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250328_032439_030944_01ECE41F X-CRM114-Status: GOOD ( 10.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 as this is already handled by XDP during xdp_rxq_info_unreg (Rx queue unregister), failing to do will cause the following warning: warning logs: https://gist.github.com/MeghanaMalladiTI/eb627e5dc8de24e42d7d46572c13e576 Fixes: 46eeb90f03e0 ("net: ti: icssg-prueth: Use page_pool API for RX buffer allocation") Signed-off-by: Meghana Malladi Reviewed-by: Simon Horman --- 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 46f500b90b17..3c0ea9044e18 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_common.c +++ b/drivers/net/ethernet/ti/icssg/icssg_common.c @@ -1215,9 +1215,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 Fri Mar 28 10:24:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Meghana Malladi X-Patchwork-Id: 14031842 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 6C10AC28B20 for ; Fri, 28 Mar 2025 10:32:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/2fyyslEH42du+dba92RsnS5u2wD2cNErCJYqvVHUdY=; b=UMI5isJqAN2DfnctYFhoMyQOJl tHMdOZYeWpAxwVAER06Q4eyp9J9ogVgVepts8OVBQdyYrIYiqYxKHA1OTc5m8Hv6Dlvw8gXvXj/p/ k6our9x3JBmmu0c/8+Fs+cw2Tr0bee3V+jRMKLMXL34IUTmBruQj5YOOiTj9re7rUVlsJpIg4J2nV C8Luw2909+IsrnThJ+CI8gtpAblKBJHtXg2xTrvMWKMcVvBZLUCJiKRAidPDI+/asTV+i2cet1crR 3OG1S7KSqULqPs6bGWuDjceu8hP8sH1PMvPkX5xO1h18CnRdJBDn0zM/X/kG1NH8yAdghxFcRfLg3 P5ikxrcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1ty70N-0000000D8uO-3xVj; Fri, 28 Mar 2025 10:32:03 +0000 Received: from fllvem-ot03.ext.ti.com ([198.47.19.245]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1ty6tO-0000000D7Uh-2zpw for linux-arm-kernel@lists.infradead.org; Fri, 28 Mar 2025 10:24:52 +0000 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllvem-ot03.ext.ti.com (8.15.2/8.15.2) with ESMTPS id 52SAOE3g2096882 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 28 Mar 2025 05:24:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1743157454; bh=/2fyyslEH42du+dba92RsnS5u2wD2cNErCJYqvVHUdY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=CTqGd2zy5ZqBynCWQyzVJo1o/DmKcCtjbnX3UT7Qz6vX3aqUY+Mk9eNc6IOxo/JD4 ZWm0GpkBv65zGg8+mylN/PuSxope1AoQsBreMyr9X5YogCzdPtuhMgLMF9MVOLWKOC ywva6nKg62zgYGMyTARjUO8BwBYXpQWjt7HYdVM0= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTP id 52SAOESF079362; Fri, 28 Mar 2025 05:24:14 -0500 Received: from DFLE113.ent.ti.com (10.64.6.34) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 28 Mar 2025 05:24:14 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) 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 via Frontend Transport; Fri, 28 Mar 2025 05:24:13 -0500 Received: from fllv0122.itg.ti.com (fllv0122.itg.ti.com [10.247.120.72]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 52SAODhZ101879; Fri, 28 Mar 2025 05:24:13 -0500 Received: from localhost (meghana-pc.dhcp.ti.com [10.24.69.13] (may be forged)) by fllv0122.itg.ti.com (8.14.7/8.14.7) with ESMTP id 52SAOCgn024937; Fri, 28 Mar 2025 05:24:13 -0500 From: Meghana Malladi To: , , , , , CC: , , , , , , , , , , , , , , , Vignesh Raghavendra , Roger Quadros , Subject: [PATCH net v3 2/3] net: ti: icssg-prueth: Fix possible NULL pointer dereference inside emac_xmit_xdp_frame() Date: Fri, 28 Mar 2025 15:54:02 +0530 Message-ID: <20250328102403.2626974-3-m-malladi@ti.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250328102403.2626974-1-m-malladi@ti.com> References: <20250328102403.2626974-1-m-malladi@ti.com> MIME-Version: 1.0 X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250328_032450_850858_D49B8A8C X-CRM114-Status: GOOD ( 15.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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") Reported-by: Dan Carpenter Closes: https://lore.kernel.org/all/70d8dd76-0c76-42fc-8611-9884937c82f5@stanley.mountain/ Signed-off-by: Meghana Malladi Reviewed-by: Simon Horman --- Changes from v2(v3-v2): - Add Reported-by tag and link to the bug reported by Dan Carpenter 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 3c0ea9044e18..15c092a923d7 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_common.c +++ b/drivers/net/ethernet/ti/icssg/icssg_common.c @@ -583,7 +583,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 */ @@ -671,8 +671,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 Fri Mar 28 10:24:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Meghana Malladi X-Patchwork-Id: 14031844 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 E7DADC36010 for ; Fri, 28 Mar 2025 10:34:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=u4tP25R7wKXZmeyNdNfbQrRvdEC/iStfy1ogy2I2G0I=; b=a0hNiiWQOlANanowTO4jtyZhrT ZMjYaAlChsSPv8aSx6Gytf0iXfwo32bJ1TCpak+rhHcUm+dkALRNymlAjWmTFoH+PkPZkHWEKrBVP DpZoHQgTYPU9qpjLyrBSolcfYonuHw0qJ6VQiuI7xgelIX8XNJxpGm4ty9LfCxIN1LoEP/Zh/ggkY EfmLrJ20cRDPdHIvlNz6pFQJAtytrVoAjPUD0hShPp0wRj55XIpTy9OIy5fw0Yh2NBIumVx+QKh4J DBYIXPixXo26kOnngUFe7NodpQfVCm5dFhyPB2Cej78jlcRrkRR7+w4MPX5eiQ5zbEj1+eWiXeBfl xAQUpy5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1ty726-0000000D91q-3Dwv; Fri, 28 Mar 2025 10:33:50 +0000 Received: from fllvem-ot03.ext.ti.com ([198.47.19.245]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1ty6tP-0000000D7V0-2q0Z for linux-arm-kernel@lists.infradead.org; Fri, 28 Mar 2025 10:24:53 +0000 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllvem-ot03.ext.ti.com (8.15.2/8.15.2) with ESMTPS id 52SAOI4d2096894 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 28 Mar 2025 05:24:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1743157458; bh=u4tP25R7wKXZmeyNdNfbQrRvdEC/iStfy1ogy2I2G0I=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=UjTCfmWLI9GYR0caRe30ghn8tIfqDc5srFVpP7vmtK/+KstuxiYWS+FuDAeES3aWF rokLxSYI2CjCR3IJKYQD4DFALV7BRsCRRwJoBTa+YLxHkp+lPfKQXtsmRHknWQihK5 R87n2zxhtHoXlOwluWmryQXO8VlYaSTIV63R8t6w= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 52SAOIer056909 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 28 Mar 2025 05:24:18 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 28 Mar 2025 05:24:17 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE105.ent.ti.com (10.64.6.26) 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; Fri, 28 Mar 2025 05:24:17 -0500 Received: from lelv0854.itg.ti.com (lelv0854.itg.ti.com [10.181.64.140]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 52SAOH0Y004266; Fri, 28 Mar 2025 05:24:17 -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 52SAOGom030930; Fri, 28 Mar 2025 05:24:17 -0500 From: Meghana Malladi To: , , , , , CC: , , , , , , , , , , , , , , , Vignesh Raghavendra , Roger Quadros , Subject: [PATCH net v3 3/3] net: ti: icss-iep: Fix possible NULL pointer dereference for perout request Date: Fri, 28 Mar 2025 15:54:03 +0530 Message-ID: <20250328102403.2626974-4-m-malladi@ti.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250328102403.2626974-1-m-malladi@ti.com> References: <20250328102403.2626974-1-m-malladi@ti.com> MIME-Version: 1.0 X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250328_032451_807180_7E243EA8 X-CRM114-Status: GOOD ( 15.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org ICSS IEP driver has flags to check if perout or pps has been enabled at any given point of time. Whenever there is request to enable or disable the signal, the driver first checks its enabled or disabled and acts accordingly. After bringing the interface down and up, calling PPS/perout enable doesn't work as the driver believes PPS is already enabled, (iep->pps_enabled is not cleared during interface bring down) and driver will just return true even though there is no signal. Fix this by setting pps and perout flags to false instead of disabling perout to avoid possible null pointer dereference. Fixes: 9b115361248d ("net: ti: icssg-prueth: Fix clearing of IEP_CMP_CFG registers during iep_init") Reported-by: Dan Carpenter Closes: https://lore.kernel.org/all/7b1c7c36-363a-4085-b26c-4f210bee1df6@stanley.mountain/ Signed-off-by: Meghana Malladi --- Changes from v2(v3-v2): - Add Reported-by tag and link to the bug reported by Dan Carpenter - drop calling icss_iep_perout_enable() for disabling perout and set perout to false instead drivers/net/ethernet/ti/icssg/icss_iep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ti/icssg/icss_iep.c b/drivers/net/ethernet/ti/icssg/icss_iep.c index b4a34c57b7b4..b70e4c482d74 100644 --- a/drivers/net/ethernet/ti/icssg/icss_iep.c +++ b/drivers/net/ethernet/ti/icssg/icss_iep.c @@ -820,9 +820,9 @@ int icss_iep_exit(struct icss_iep *iep) icss_iep_disable(iep); if (iep->pps_enabled) - icss_iep_pps_enable(iep, false); + iep->pps_enabled = false; else if (iep->perout_enabled) - icss_iep_perout_enable(iep, NULL, false); + iep->perout_enabled = false; return 0; }