diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2013-06-18 13:30:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-20 01:18:52 -0400 |
commit | 451bff2932a69e904f41a180145de1d2358bb8f5 (patch) | |
tree | 138b61ddd6a8624224017c0e313436f7aa48dd2f | |
parent | 776fbcc9cbece10756bdb67b48a0798e6446f16b (diff) |
pxa168_eth: Allocate receive queue initialized to zero
Zero pointer in rx_skb or tx_skb is how respective *_deinit() functions find
out that a skb slot is unallocated. If *_init() functions unsuccessfully return
after the allocation (e.g. when subsequent dma_alloc_coherent() is not
successful), this would result in attempt to kfree() invalid pointers.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Cc: Kosta Zertsekel <konszert@marvell.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/marvell/pxa168_eth.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c index 339bb323cb0c..1c8af8ba08d9 100644 --- a/drivers/net/ethernet/marvell/pxa168_eth.c +++ b/drivers/net/ethernet/marvell/pxa168_eth.c | |||
@@ -1015,7 +1015,7 @@ static int rxq_init(struct net_device *dev) | |||
1015 | int rx_desc_num = pep->rx_ring_size; | 1015 | int rx_desc_num = pep->rx_ring_size; |
1016 | 1016 | ||
1017 | /* Allocate RX skb rings */ | 1017 | /* Allocate RX skb rings */ |
1018 | pep->rx_skb = kmalloc(sizeof(*pep->rx_skb) * pep->rx_ring_size, | 1018 | pep->rx_skb = kzalloc(sizeof(*pep->rx_skb) * pep->rx_ring_size, |
1019 | GFP_KERNEL); | 1019 | GFP_KERNEL); |
1020 | if (!pep->rx_skb) | 1020 | if (!pep->rx_skb) |
1021 | return -ENOMEM; | 1021 | return -ENOMEM; |
@@ -1076,7 +1076,7 @@ static int txq_init(struct net_device *dev) | |||
1076 | int size = 0, i = 0; | 1076 | int size = 0, i = 0; |
1077 | int tx_desc_num = pep->tx_ring_size; | 1077 | int tx_desc_num = pep->tx_ring_size; |
1078 | 1078 | ||
1079 | pep->tx_skb = kmalloc(sizeof(*pep->tx_skb) * pep->tx_ring_size, | 1079 | pep->tx_skb = kzalloc(sizeof(*pep->tx_skb) * pep->tx_ring_size, |
1080 | GFP_KERNEL); | 1080 | GFP_KERNEL); |
1081 | if (!pep->tx_skb) | 1081 | if (!pep->tx_skb) |
1082 | return -ENOMEM; | 1082 | return -ENOMEM; |