diff options
author | Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> | 2006-01-18 20:42:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-18 22:20:20 -0500 |
commit | c42791b6ec5453cd7910eac7bfdd88f27173f81c (patch) | |
tree | f874b541bfacb27df2bcfdf6fe5823353d431635 /arch/um | |
parent | 3b948068b84b9759cdf0965abf3074dcb9230e98 (diff) |
[PATCH] uml: make daemon transport behave properly
Avoid uninitialized data in the daemon_data structure. I used this transport
before doing proper setup before-hand, and I got some very nice SLAB
corruption due to freeing crap pointers. So just make sure to clear
everything when appropriate.
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')
-rw-r--r-- | arch/um/drivers/daemon_kern.c | 4 | ||||
-rw-r--r-- | arch/um/drivers/daemon_user.c | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/arch/um/drivers/daemon_kern.c b/arch/um/drivers/daemon_kern.c index 30d285b266af..507e3cbac9d3 100644 --- a/arch/um/drivers/daemon_kern.c +++ b/arch/um/drivers/daemon_kern.c | |||
@@ -31,6 +31,10 @@ void daemon_init(struct net_device *dev, void *data) | |||
31 | dpri->fd = -1; | 31 | dpri->fd = -1; |
32 | dpri->control = -1; | 32 | dpri->control = -1; |
33 | dpri->dev = dev; | 33 | dpri->dev = dev; |
34 | /* We will free this pointer. If it contains crap we're burned. */ | ||
35 | dpri->ctl_addr = NULL; | ||
36 | dpri->data_addr = NULL; | ||
37 | dpri->local_addr = NULL; | ||
34 | 38 | ||
35 | printk("daemon backend (uml_switch version %d) - %s:%s", | 39 | printk("daemon backend (uml_switch version %d) - %s:%s", |
36 | SWITCH_VERSION, dpri->sock_type, dpri->ctl_sock); | 40 | SWITCH_VERSION, dpri->sock_type, dpri->ctl_sock); |
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c index 1bb085b2824d..c944265955e2 100644 --- a/arch/um/drivers/daemon_user.c +++ b/arch/um/drivers/daemon_user.c | |||
@@ -158,10 +158,16 @@ static void daemon_remove(void *data) | |||
158 | struct daemon_data *pri = data; | 158 | struct daemon_data *pri = data; |
159 | 159 | ||
160 | os_close_file(pri->fd); | 160 | os_close_file(pri->fd); |
161 | pri->fd = -1; | ||
161 | os_close_file(pri->control); | 162 | os_close_file(pri->control); |
163 | pri->control = -1; | ||
164 | |||
162 | kfree(pri->data_addr); | 165 | kfree(pri->data_addr); |
166 | pri->data_addr = NULL; | ||
163 | kfree(pri->ctl_addr); | 167 | kfree(pri->ctl_addr); |
168 | pri->ctl_addr = NULL; | ||
164 | kfree(pri->local_addr); | 169 | kfree(pri->local_addr); |
170 | pri->local_addr = NULL; | ||
165 | } | 171 | } |
166 | 172 | ||
167 | int daemon_user_write(int fd, void *buf, int len, struct daemon_data *pri) | 173 | int daemon_user_write(int fd, void *buf, int len, struct daemon_data *pri) |