[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<BY3PR18MB47379D136DE21EDB8C1741CAC6C92@BY3PR18MB4737.namprd18.prod.outlook.com>
Date: Fri, 21 Jun 2024 05:11:41 +0000
From: Sunil Kovvuri Goutham <sgoutham@...vell.com>
To: Huai-Yuan Liu <qq810974084@...il.com>,
"jes@...ined-monkey.org"
<jes@...ined-monkey.org>,
"davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"kuba@...nel.org"
<kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>
CC: "linux-hippi@...site.dk" <linux-hippi@...site.dk>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"baijiaju1990@...il.com" <baijiaju1990@...il.com>
Subject: RE: [PATCH V2] hippi: fix possible buffer overflow caused by bad DMA
value in rr_start_xmit()
>The value rrpriv->info->tx_ctrl is stored in DMA memory, and it is assigned to txctrl,
>so txctrl->pi can be modified at any time by malicious hardware. Becausetxctrl->pi is
>assigned to index, buffer overflow may occur when the code "rrpriv-
>>tx_skbuff[index]" is executed.
>
>To address this issue, the index should be checked.
>
>Fixes: f33a7251c825 ("hippi: switch from 'pci_' to 'dma_' API")
>Signed-off-by: Huai-Yuan Liu <qq810974084@...il.com>
>---
>V2:
>* In patch V2, we remove the first condition in if statement and use
> netdev_err() instead of printk().
> Thanks Paolo Abeni for helpful advice.
>---
> drivers/net/hippi/rrunner.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
>diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c index
>aa8f828a0ae7..6b0056ced922 100644
>--- a/drivers/net/hippi/rrunner.c
>+++ b/drivers/net/hippi/rrunner.c
>@@ -1440,6 +1440,11 @@ static netdev_tx_t rr_start_xmit(struct sk_buff *skb,
> txctrl = &rrpriv->info->tx_ctrl;
>
> index = txctrl->pi;
>+ if (index >= TX_RING_ENTRIES) {
>+ netdev_err(dev, "invalid index value %02x\n", index);
Much better would be to use netif_msg_tx_err which can be enabled/disabled instead of dumping on console,
which would be annoying if there are many errors.
Thanks,
Sunil.
Powered by blists - more mailing lists