diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-05-06 17:51:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-07 15:13:00 -0400 |
commit | f34d9d2dcb7f17b64124841345b23adc0843e7a5 (patch) | |
tree | 0bb200273bcc37da8dd32945ae25c213c9efe2c2 /arch/um/drivers/pcap_user.c | |
parent | b16895b63c504698b0c3ab26ca3c41a4fa162a42 (diff) |
uml: network interface hotplug error handling
This fixes a number of problems associated with network interface hotplug.
The userspace initialization function can fail in some cases, but the
failure was never passed back to eth_configure, which proceeded with the
configuration. This results in a zombie device that is present, but can't
work. This is fixed by allowing the initialization routines to return an
error, which is checked, and the configuration aborted on failure.
eth_configure failed to check for many failures. Even when it did check,
it didn't undo whatever initializations has already happened, so a present,
but partially initialized and non-working device could result. It now
checks everything that can fail, and bails out, undoing whatever had been
done.
The return value of eth_configure was always ignored, so it is now just
void.
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/drivers/pcap_user.c')
-rw-r--r-- | arch/um/drivers/pcap_user.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/um/drivers/pcap_user.c b/arch/um/drivers/pcap_user.c index a1747dc0ff6f..dc0a903ef9a6 100644 --- a/arch/um/drivers/pcap_user.c +++ b/arch/um/drivers/pcap_user.c | |||
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | #define PCAP_FD(p) (*(int *)(p)) | 19 | #define PCAP_FD(p) (*(int *)(p)) |
20 | 20 | ||
21 | static void pcap_user_init(void *data, void *dev) | 21 | static int pcap_user_init(void *data, void *dev) |
22 | { | 22 | { |
23 | struct pcap_data *pri = data; | 23 | struct pcap_data *pri = data; |
24 | pcap_t *p; | 24 | pcap_t *p; |
@@ -28,11 +28,12 @@ static void pcap_user_init(void *data, void *dev) | |||
28 | if(p == NULL){ | 28 | if(p == NULL){ |
29 | printk("pcap_user_init : pcap_open_live failed - '%s'\n", | 29 | printk("pcap_user_init : pcap_open_live failed - '%s'\n", |
30 | errors); | 30 | errors); |
31 | return; | 31 | return -EINVAL; |
32 | } | 32 | } |
33 | 33 | ||
34 | pri->dev = dev; | 34 | pri->dev = dev; |
35 | pri->pcap = p; | 35 | pri->pcap = p; |
36 | return 0; | ||
36 | } | 37 | } |
37 | 38 | ||
38 | static int pcap_open(void *data) | 39 | static int pcap_open(void *data) |