[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1411501274-2970-1-git-send-email-mark.einon@gmail.com>
Date: Tue, 23 Sep 2014 20:41:11 +0100
From: Mark Einon <mark.einon@...il.com>
To: gregkh@...uxfoundation.org
Cc: devel@...verdev.osuosl.org, tklauser@...tanz.ch,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Mark Einon <mark.einon@...il.com>
Subject: [PATCH 1/4] staging: et131x: zero allocation of fbr to prevent random address access
If et131x_rx_dma_memory_alloc() allocates rx_ring->fbr[0] but fails to
allocate rx_ring->fbr[1], this leaves fbr[0]->ring_virtaddr with the
possibility of being accessed in et131x_rx_dma_memory_free() as it
contains a random value, potentially causing an oops.
Fix this by zeroing the fbr memory on allocation. Subsequent frees of
this fbr memory explicitly zeros the ring_virtaddr value.
Reported-by: Tobias Klauser <tklauser@...tanz.ch>
Signed-off-by: Mark Einon <mark.einon@...il.com>
---
drivers/staging/et131x/et131x.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 93afd61..2889f86 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -2003,10 +2003,10 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
struct fbr_lookup *fbr;
/* Alloc memory for the lookup table */
- rx_ring->fbr[0] = kmalloc(sizeof(*fbr), GFP_KERNEL);
+ rx_ring->fbr[0] = kzalloc(sizeof(*fbr), GFP_KERNEL);
if (rx_ring->fbr[0] == NULL)
return -ENOMEM;
- rx_ring->fbr[1] = kmalloc(sizeof(*fbr), GFP_KERNEL);
+ rx_ring->fbr[1] = kzalloc(sizeof(*fbr), GFP_KERNEL);
if (rx_ring->fbr[1] == NULL)
return -ENOMEM;
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists