Skip to content

Commit

Permalink
[PATCH] uml: networking - clear transport-specific structure
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paolo 'Blaisorblade' Giarrusso authored and Linus Torvalds committed Jan 19, 2006
1 parent c42791b commit e56a788
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion arch/um/drivers/net_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e56a788

Please sign in to comment.