From 9351982b25ace7ee5ed82b6f4a7ea1151f31d267 Mon Sep 17 00:00:00 2001 From: Micah Gruber Date: Mon, 23 Jul 2007 16:05:52 +0800 Subject: [PATCH] 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 Signed-off-by: Jeff Garzik --- drivers/net/usb/pegasus.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c index a05fd97e5bc..04cba6bf3d5 100644 --- a/drivers/net/usb/pegasus.c +++ b/drivers/net/usb/pegasus.c @@ -768,11 +768,13 @@ done: static void write_bulk_callback(struct urb *urb) { pegasus_t *pegasus = urb->context; - struct net_device *net = pegasus->net; + struct net_device *net; if (!pegasus) return; + net = pegasus->net; + if (!netif_device_present(net) || !netif_running(net)) return; -- 2.41.1