* [PATCH] mv643xx_eth: Allocate receive queue initialized to zero
@ 2013-06-18 17:32 Lubomir Rintel
2013-06-20 5:19 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Lubomir Rintel @ 2013-06-18 17:32 UTC (permalink / raw)
To: Lennert Buytenhek; +Cc: Lubomir Rintel, Lennert Buytenhek, netdev, linux-kernel
Zero pointer in rx_skb is how respective rxq_deinit() finds out out that a skb
slot is unallocated. If rxq_refill() fails (e.g. on OOM condition), subsequent
teardown would result in an attempt to kfree() invalid pointers.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Cc: Lennert Buytenhek <buytenh@wantstofly.org>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
drivers/net/ethernet/marvell/mv643xx_eth.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 2ad1494..d1cbfb1 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -1757,7 +1757,7 @@ static int rxq_init(struct mv643xx_eth_private *mp, int index)
memset(rxq->rx_desc_area, 0, size);
rxq->rx_desc_area_size = size;
- rxq->rx_skb = kmalloc_array(rxq->rx_ring_size, sizeof(*rxq->rx_skb),
+ rxq->rx_skb = kcalloc(rxq->rx_ring_size, sizeof(*rxq->rx_skb),
GFP_KERNEL);
if (rxq->rx_skb == NULL)
goto out_free;
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mv643xx_eth: Allocate receive queue initialized to zero
2013-06-18 17:32 [PATCH] mv643xx_eth: Allocate receive queue initialized to zero Lubomir Rintel
@ 2013-06-20 5:19 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-06-20 5:19 UTC (permalink / raw)
To: lkundrak; +Cc: buytenh, netdev, linux-kernel
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Tue, 18 Jun 2013 19:32:38 +0200
> Zero pointer in rx_skb is how respective rxq_deinit() finds out out that a skb
> slot is unallocated. If rxq_refill() fails (e.g. on OOM condition), subsequent
> teardown would result in an attempt to kfree() invalid pointers.
>
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-06-20 5:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-18 17:32 [PATCH] mv643xx_eth: Allocate receive queue initialized to zero Lubomir Rintel
2013-06-20 5:19 ` David Miller
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).