summaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/net_kern.c
diff options
context:
space:
mode:
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>2006-01-18 17:42:55 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-18 19:20:21 -0800
commite56a78855a4f72fc658bfd21d08939dd6e09fa4c (patch)
treefcb56d8a23bad9824e72ef8fb26e688726061d9d /arch/um/drivers/net_kern.c
parentc42791b6ec5453cd7910eac7bfdd88f27173f81c (diff)
downloadtalos-obmc-linux-e56a78855a4f72fc658bfd21d08939dd6e09fa4c.tar.gz
talos-obmc-linux-e56a78855a4f72fc658bfd21d08939dd6e09fa4c.zip
[PATCH] uml: networking - clear transport-specific structure
Pre-clear transport-specific private structure before passing it down. In fact, I just got a slab corruption and kernel panic on exit because kfree() was called on a pointer which probably was never allocated, BUT hadn't been set to NULL by the driver. As the code is full of such errors, I've decided for now to go the safe way (we're talking about drivers), and to do the simple thing. I'm also starting to fix drivers, and already sent a patch for the daemon transport. Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Cc: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/drivers/net_kern.c')
-rw-r--r--arch/um/drivers/net_kern.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index fb1f9fb9b871..f3442ce29a21 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -317,6 +317,11 @@ static int eth_configure(int n, void *init, char *mac,
return 1;
}
+ lp = dev->priv;
+ /* This points to the transport private data. It's still clear, but we
+ * must memset it to 0 *now*. Let's help the drivers. */
+ memset(lp, 0, size);
+
/* sysfs register */
if (!driver_registered) {
platform_driver_register(&uml_net_driver);
@@ -358,7 +363,6 @@ static int eth_configure(int n, void *init, char *mac,
free_netdev(dev);
return 1;
}
- lp = dev->priv;
/* lp.user is the first four bytes of the transport data, which
* has already been initialized. This structure assignment will
OpenPOWER on IntegriCloud