can: Fix possible NULL pointer dereference in ems_usb.c

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Saturday, April 24, 2010 - 3:59 pm

Gitweb:     http://git.kernel.org/linus/1c0b28b1ee90261a0a27194e6684dd2837785064
Commit:     1c0b28b1ee90261a0a27194e6684dd2837785064
Parent:     05d17608a69b3ae653ea5c9857283bef3439c733
Author:     Hans J. Koch <hjk@linutronix.de>
AuthorDate: Wed Apr 21 00:18:06 2010 +0000
Committer:  David S. Miller <davem@davemloft.net>
CommitDate: Wed Apr 21 16:14:51 2010 -0700

    can: Fix possible NULL pointer dereference in ems_usb.c
    
    In ems_usb_probe(), a pointer is dereferenced after making sure it is NULL...
    
    This patch replaces netdev->dev.parent with &intf->dev in dev_err() calls to
    avoid this.
    
    Signed-off-by: "Hans J. Koch" <hjk@linutronix.de>
    Acked-by: Wolfgang Grandegger <wg@grandegger.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/can/usb/ems_usb.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index 3345109..d800b59 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -1006,7 +1006,7 @@ static int ems_usb_probe(struct usb_interface *intf,
 
 	netdev = alloc_candev(sizeof(struct ems_usb), MAX_TX_URBS);
 	if (!netdev) {
-		dev_err(netdev->dev.parent, "Couldn't alloc candev\n");
+		dev_err(&intf->dev, "ems_usb: Couldn't alloc candev\n");
 		return -ENOMEM;
 	}
 
@@ -1036,20 +1036,20 @@ static int ems_usb_probe(struct usb_interface *intf,
 
 	dev->intr_urb = usb_alloc_urb(0, GFP_KERNEL);
 	if (!dev->intr_urb) {
-		dev_err(netdev->dev.parent, "Couldn't alloc intr URB\n");
+		dev_err(&intf->dev, "Couldn't alloc intr URB\n");
 		goto cleanup_candev;
 	}
 
 	dev->intr_in_buffer = kzalloc(INTR_IN_BUFFER_SIZE, GFP_KERNEL);
 	if (!dev->intr_in_buffer) {
-		dev_err(netdev->dev.parent, "Couldn't alloc Intr buffer\n");
+		dev_err(&intf->dev, "Couldn't alloc Intr buffer\n");
 		goto cleanup_intr_urb;
 	}
 
 	dev->tx_msg_buffer = kzalloc(CPC_HEADER_SIZE +
 				     sizeof(struct ems_cpc_msg), GFP_KERNEL);
 	if (!dev->tx_msg_buffer) {
-		dev_err(netdev->dev.parent, "Couldn't alloc Tx buffer\n");
+		dev_err(&intf->dev, "Couldn't alloc Tx buffer\n");
 		goto cleanup_intr_in_buffer;
 	}
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
can: Fix possible NULL pointer dereference in ems_usb.c, Linux Kernel Mailing ..., (Sat Apr 24, 3:59 pm)