Skip to content

Commit

Permalink
net: net_assign_generic() fix
Browse files Browse the repository at this point in the history
memcpy() should take into account size of pointers,
not only number of pointers to copy.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Aug 2, 2009
1 parent 446e72f commit 1445863
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/core/net_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ int net_assign_generic(struct net *net, int id, void *data)
*/

ng->len = id;
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);
Expand Down

0 comments on commit 1445863

Please sign in to comment.