Skip to content

Commit

Permalink
Fix a potential NULL pointer dereference in write_bulk_callback() in …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Micah Gruber authored and Jeff Garzik committed Jul 30, 2007
1 parent 80ba80a commit 9351982
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/usb/pegasus.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,11 +768,13 @@ static void rx_fixup(unsigned long data)
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;

Expand Down

0 comments on commit 9351982

Please sign in to comment.