[patch 2/4] net: net_assign_generic() fix

From: Greg KH
Date: Thu Sep 10 2009 - 20:34:47 EST


2.6.27-stable review patch. If anyone has any objections, please let us know.

------------------
From: Eric Dumazet <eric.dumazet@xxxxxxxxx>

[ Upstream commit 144586301f6af5ae5943a002f030d8c626fa4fdd ]

memcpy() should take into account size of pointers,
not only number of pointers to copy.

Signed-off-by: Eric Dumazet <eric.dumazet@xxxxxxxxx>
Acked-by: Pavel Emelyanov <xemul@xxxxxxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
net/core/net_namespace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -446,7 +446,7 @@ int net_assign_generic(struct net *net,

ng->len = id;
INIT_RCU_HEAD(&ng->rcu);
- memcpy(&ng->ptr, &old_ng->ptr, old_ng->len);
+ memcpy(&ng->ptr, &old_ng->ptr, old_ng->len * sizeof(void*));

rcu_assign_pointer(net->gen, ng);
call_rcu(&old_ng->rcu, net_generic_release);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/