Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Wed, 12 Mar 2003 14:31:54 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Wed, 12 Mar 2003 14:31:54 -0500 Received: from home.linuxhacker.ru ([194.67.236.68]:22945 "EHLO linuxhacker.ru") by vger.kernel.org with ESMTP id ; Wed, 12 Mar 2003 14:31:52 -0500 Date: Wed, 12 Mar 2003 22:41:33 +0300 From: Oleg Drokin To: alan@redhat.com, linux-kernel@vger.kernel.org, greg@kroah.com, david-b@pacbell.net Subject: [2.4] Memleak in drivers/usb/hub.c::usb_reset_device Message-ID: <20030312194133.GA27968@linuxhacker.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 849 Lines: 28 Hello! There seems to be a memleak in drivers/usb/hub.c::usb_reset_device() on error exit path. See the patch. Found with help of smatch + enhanced unfree script. Bye, Oleg ===== drivers/usb/hub.c 1.19 vs edited ===== --- 1.19/drivers/usb/hub.c Sat Sep 21 00:12:53 2002 +++ edited/drivers/usb/hub.c Wed Mar 12 22:38:43 2003 @@ -1057,8 +1057,10 @@ } ret = usb_get_descriptor(dev, USB_DT_DEVICE, 0, descriptor, sizeof(*descriptor)); - if (ret < 0) + if (ret < 0) { + kfree(descriptor); return ret; + } le16_to_cpus(&descriptor->bcdUSB); le16_to_cpus(&descriptor->idVendor); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/