diff options
author | Micah Gruber <micah.gruber@gmail.com> | 2007-07-23 04:05:52 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-07-30 15:44:50 -0400 |
commit | 9351982b25ace7ee5ed82b6f4a7ea1151f31d267 (patch) | |
tree | c12bba41d41a68e44bf8fdaeb9780fc17a0c647d | |
parent | 80ba80a9bf25d251237694c3fcee850a73324532 (diff) |
Fix a potential NULL pointer dereference in write_bulk_callback() in drivers/net/usb/pegasus.c
This patch fixes a potential null dereference bug where we dereference
pegasus before a null check. This patch simply moves the dereferencing
after the null check.
Signed-off-by: Micah Gruber <micah.gruber@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/net/usb/pegasus.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c index a05fd97e5bc2..04cba6bf3d54 100644 --- a/drivers/net/usb/pegasus.c +++ b/drivers/net/usb/pegasus.c | |||
@@ -768,11 +768,13 @@ done: | |||
768 | static void write_bulk_callback(struct urb *urb) | 768 | static void write_bulk_callback(struct urb *urb) |
769 | { | 769 | { |
770 | pegasus_t *pegasus = urb->context; | 770 | pegasus_t *pegasus = urb->context; |
771 | struct net_device *net = pegasus->net; | 771 | struct net_device *net; |
772 | 772 | ||
773 | if (!pegasus) | 773 | if (!pegasus) |
774 | return; | 774 | return; |
775 | 775 | ||
776 | net = pegasus->net; | ||
777 | |||
776 | if (!netif_device_present(net) || !netif_running(net)) | 778 | if (!netif_device_present(net) || !netif_running(net)) |
777 | return; | 779 | return; |
778 | 780 | ||