[<prev] [next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1101232301510.30955@swampdragon.chaosbits.net>
Date: Sun, 23 Jan 2011 23:08:31 +0100 (CET)
From: Jesper Juhl <jj@...osbits.net>
To: linux-usb@...r.kernel.org
cc: Greg Kroah-Hartman <gregkh@...e.de>,
Mike Frysinger <vapier@...too.org>,
Alan Stern <stern@...land.harvard.edu>,
Michael Hennerich <michael.hennerich@...log.com>,
Kulikov Vasiliy <segooon@...il.com>,
David Brownell <dbrownell@...rs.sourceforge.net>,
linux-kernel@...r.kernel.org
Subject: [PATCH] USB SL811HS HCD: Fix memory leak in sl811h_urb_enqueue()
In drivers/usb/host/sl811-hcd.c::sl811h_urb_enqueue(), memory is allocated
with kzalloc() and assigned to 'ep'. If we leave via the 'fail' label due
to 'if (ep->maxpacket > H_MAXPACKET)', then 'ep' will go out of scope
without having been assigned to anything, so we'll leak the memory we
allocated.
This patch fixes the leak by simply calling kfree(ep); before jumping to
the 'fail' label.
Signed-off-by: Jesper Juhl <jj@...osbits.net>
---
sl811-hcd.c | 1 +
1 file changed, 1 insertion(+)
I don't have hardware to test this, so compile tested only.
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 990f06b..2e9602a 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -861,6 +861,7 @@ static int sl811h_urb_enqueue(
DBG("dev %d ep%d maxpacket %d\n",
udev->devnum, epnum, ep->maxpacket);
retval = -EINVAL;
+ kfree(ep);
goto fail;
}
--
Jesper Juhl <jj@...osbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists