All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB Pegasus driver - avoid a potential NULL pointer dereference.
@ 2007-07-28 22:19 ` Jesper Juhl
  0 siblings, 0 replies; 13+ messages in thread
From: Jesper Juhl @ 2007-07-28 22:19 UTC (permalink / raw)
  To: Petko Manolov
  Cc: Linux Kernel Mailing List, Greg Kroah-Hartman, linux-usb-devel,
	netdev, Jesper Juhl

Hello,

This patch makes sure we don't dereference a NULL pointer in 
drivers/net/usb/pegasus.c::write_bulk_callback() in the initial 
struct net_device *net = pegasus->net; assignment.
The existing code checks if 'pegasus' is NULL and bails out if 
it is, so we better not touch that pointer until after that check.

Please consider merging.


Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---

 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 a05fd97..04cba6b 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;
 


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2007-07-30  8:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-28 22:19 [PATCH] USB Pegasus driver - avoid a potential NULL pointer dereference Jesper Juhl
2007-07-28 22:19 ` Jesper Juhl
2007-07-28 23:37 ` Satyam Sharma
2007-07-28 23:37   ` Satyam Sharma
2007-07-28 23:55   ` Jesper Juhl
2007-07-28 23:55     ` Jesper Juhl
2007-07-29  8:49     ` [linux-usb-devel] " Oliver Neukum
2007-07-29 18:18       ` Satyam Sharma
2007-07-29 18:18         ` Satyam Sharma
2007-07-30  8:05       ` [linux-usb-devel] " Petko Manolov
2007-07-30  8:05         ` Petko Manolov
2007-07-30  8:54         ` [linux-usb-devel] " Satyam Sharma
2007-07-30  8:54           ` Satyam Sharma

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.