* [PATCH] net/qlcnic: fix possible use-after-free bugs in qlcnic_alloc_rx_skb()
@ 2023-09-13 10:41 Ma Ke
2023-09-15 5:45 ` Simon Horman
0 siblings, 1 reply; 2+ messages in thread
From: Ma Ke @ 2023-09-13 10:41 UTC (permalink / raw)
To: shshaikh, manishc, davem, edumazet, kuba, pabeni,
GR-Linux-NIC-Dev
Cc: netdev, linux-kernel, Ma Ke
In qlcnic_alloc_rx_skb(), when dma_map_single() fails, skb is freed
immediately. And skb could be freed again. This issue could allow a
local attacker to crash the system due to a use-after-free flaw.
Signed-off-by: Ma Ke <make_ruc2021@163.com>
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
index 41894d154013..6501aaf2b5ce 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
@@ -832,6 +832,7 @@ static int qlcnic_alloc_rx_skb(struct qlcnic_adapter *adapter,
if (dma_mapping_error(&pdev->dev, dma)) {
adapter->stats.rx_dma_map_error++;
dev_kfree_skb_any(skb);
+ skb = NULL;
return -ENOMEM;
}
--
2.37.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net/qlcnic: fix possible use-after-free bugs in qlcnic_alloc_rx_skb()
2023-09-13 10:41 [PATCH] net/qlcnic: fix possible use-after-free bugs in qlcnic_alloc_rx_skb() Ma Ke
@ 2023-09-15 5:45 ` Simon Horman
0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2023-09-15 5:45 UTC (permalink / raw)
To: Ma Ke
Cc: shshaikh, manishc, davem, edumazet, kuba, pabeni,
GR-Linux-NIC-Dev, netdev, linux-kernel
On Wed, Sep 13, 2023 at 06:41:19PM +0800, Ma Ke wrote:
> In qlcnic_alloc_rx_skb(), when dma_map_single() fails, skb is freed
> immediately. And skb could be freed again. This issue could allow a
> local attacker to crash the system due to a use-after-free flaw.
>
> Signed-off-by: Ma Ke <make_ruc2021@163.com>
> ---
> drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> index 41894d154013..6501aaf2b5ce 100644
> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> @@ -832,6 +832,7 @@ static int qlcnic_alloc_rx_skb(struct qlcnic_adapter *adapter,
> if (dma_mapping_error(&pdev->dev, dma)) {
> adapter->stats.rx_dma_map_error++;
> dev_kfree_skb_any(skb);
> + skb = NULL;
> return -ENOMEM;
Hi Ma Ke,
I am a unclear on how skb could be freed a second time.
skb is a local variable which goes out of scope when
the function returns.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-15 5:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-13 10:41 [PATCH] net/qlcnic: fix possible use-after-free bugs in qlcnic_alloc_rx_skb() Ma Ke
2023-09-15 5:45 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).