[PATCH: usbatm_15_05_05] usbatm_usb_probe() bugfix.

Stanislaw W. Gruszka stf at xl.wp.pl
Thu May 26 16:05:25 EDT 2005


Hi, 
I found bug generating oops in usbatm_usb_probe() when bind fail. 
Also I fix memory lackage, which occurs on very special case.
--
Staszek Gruszka

diff -up usbatm.c{.orig,}

--- usbatm.c.orig	2005-05-26 21:15:07.000000000 +0200
+++ usbatm.c	2005-05-26 21:22:32.000000000 +0200
@@ -966,7 +966,7 @@ int usbatm_usb_probe(struct usb_interfac
 		return -ENOMEM;
 	}
 
-	memset(instance, 0, sizeof(*instance));
+	memset(instance, 0, sizeof(*instance) + sizeof(struct urb *) * (num_rcv_urbs 
+ num_snd_urbs));
 
 	/* public fields */
 
@@ -1062,6 +1062,7 @@ int usbatm_usb_probe(struct usb_interfac
 		buffer = kmalloc(channel->buf_size, GFP_KERNEL);
 		if (!buffer) {
 			dev_dbg(dev, "%s: no memory for buffer %d!\n", __func__, i);
+			usb_free_urb(urb);
 			goto fail_unbind;
 		}
 		memset(buffer, 0, channel->buf_size);





More information about the Usbatm mailing list