[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <90238577e00a7a996767b84769b5e03ef840b13a.1706804455.git.thinhtr@linux.vnet.ibm.com>
Date: Thu, 1 Feb 2024 11:48:21 -0600
From: Thinh Tran <thinhtr@...ux.vnet.ibm.com>
To: kuba@...nel.org
Cc: netdev@...r.kernel.org, aelior@...vell.com, davem@...emloft.net,
manishc@...vell.com, pabeni@...hat.com, skalluru@...vell.com,
simon.horman@...igine.com, edumazet@...gle.com,
VENKATA.SAI.DUGGI@....com, drc@...ux.vnet.ibm.com, abdhalee@...ibm.com,
thinhtr@...ux.vnet.ibm.com
Subject: [PATCH v7 1/2] net/bnx2x: Prevent access to a freed page in page_pool
Verify page pool allocations before freeing.
Signed-off-by: Thinh Tran <thinhtr@...ux.vnet.ibm.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
index d8b1824c334d..0bc1367fd649 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
@@ -1002,9 +1002,6 @@ static inline void bnx2x_set_fw_mac_addr(__le16 *fw_hi, __le16 *fw_mid,
static inline void bnx2x_free_rx_mem_pool(struct bnx2x *bp,
struct bnx2x_alloc_pool *pool)
{
- if (!pool->page)
- return;
-
put_page(pool->page);
pool->page = NULL;
@@ -1015,6 +1012,9 @@ static inline void bnx2x_free_rx_sge_range(struct bnx2x *bp,
{
int i;
+ if (!fp->page_pool.page)
+ return;
+
if (fp->mode == TPA_MODE_DISABLED)
return;
--
2.25.1
Powered by blists - more mailing lists