From: Francois Romieu <romieu@fr.zoreil.com>
Date: Mon, 27 Feb 2006 22:11:08 +0000 (+0100)
Subject: via-velocity: fix memory corruption when changing the mtu
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b3c3e7d7d9795df16012d5c60e5f789e7fade311;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

via-velocity: fix memory corruption when changing the mtu

velocity_rx_refill() only replenishes the descriptor entries which
belong to the CPU. It works great in the Rx path but the driver must
ensure that all the descriptors are freed before velocity_rx_refill()
is used in velocity_change_mtu(). The patch resets the Rx descriptors
in velocity_free_rd_ring().

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
---

diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index c2d5907dc8e0..ed1f837c8fda 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -1106,6 +1106,9 @@ static void velocity_free_rd_ring(struct velocity_info *vptr)
 
 	for (i = 0; i < vptr->options.numrx; i++) {
 		struct velocity_rd_info *rd_info = &(vptr->rd_info[i]);
+		struct rx_desc *rd = vptr->rd_ring + i;
+
+		memset(rd, 0, sizeof(*rd));
 
 		if (!rd_info->skb)
 			continue;