aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorroel kluin <roel.kluin@gmail.com>2009-08-09 21:29:52 -0400
committerDavid S. Miller <davem@davemloft.net>2009-08-13 19:26:10 -0400
commit8dd07086a1f8048428d33a1917b6209978750cb1 (patch)
tree2f6ba6838459114c802302a89d049ee2ef7a2458 /drivers
parenta6fa32866567351503db8a5c3466a676ba08595f (diff)
lmc: Read outside array bounds
If dev_alloc_skb() fails on the first iteration of the allocation loop, then we end up writing before the start of the array. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wan/lmc/lmc_main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
index d1492ae5d30a..6e6b08c3a1e0 100644
--- a/drivers/net/wan/lmc/lmc_main.c
+++ b/drivers/net/wan/lmc/lmc_main.c
@@ -1897,11 +1897,12 @@ static void lmc_softreset (lmc_softc_t * const sc) /*fold00*/
1897 /* 1897 /*
1898 * Sets end of ring 1898 * Sets end of ring
1899 */ 1899 */
1900 sc->lmc_rxring[i - 1].length |= 0x02000000; /* Set end of buffers flag */ 1900 if (i != 0) {
1901 sc->lmc_rxring[i - 1].buffer2 = virt_to_bus (&sc->lmc_rxring[0]); /* Point back to the start */ 1901 sc->lmc_rxring[i - 1].length |= 0x02000000; /* Set end of buffers flag */
1902 sc->lmc_rxring[i - 1].buffer2 = virt_to_bus(&sc->lmc_rxring[0]); /* Point back to the start */
1903 }
1902 LMC_CSR_WRITE (sc, csr_rxlist, virt_to_bus (sc->lmc_rxring)); /* write base address */ 1904 LMC_CSR_WRITE (sc, csr_rxlist, virt_to_bus (sc->lmc_rxring)); /* write base address */
1903 1905
1904
1905 /* Initialize the transmit rings and buffers */ 1906 /* Initialize the transmit rings and buffers */
1906 for (i = 0; i < LMC_TXDESCS; i++) 1907 for (i = 0; i < LMC_TXDESCS; i++)
1907 { 1908 {