From: Al Viro <viro@ftp.linux.org.uk>
To: torvalds@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, gregkh@suse.de
Subject: [PATCH] minimal fixes for drivers/usb/gadget/m66592-udc.c
Date: Sun, 15 Jul 2007 20:59:22 +0100 [thread overview]
Message-ID: <E1IAAFW-00053E-0T@ZenIV.linux.org.uk> (raw)
still looks racy (and definitely leaks)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
drivers/usb/gadget/m66592-udc.c | 27 ++++-----------------------
1 files changed, 4 insertions(+), 23 deletions(-)
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c
index c0a962b..0174a32 100644
--- a/drivers/usb/gadget/m66592-udc.c
+++ b/drivers/usb/gadget/m66592-udc.c
@@ -937,6 +937,7 @@ static void get_status(struct m66592 *m66592, struct usb_ctrlrequest *ctrl)
*m66592->ep0_buf = status;
m66592->ep0_req->buf = m66592->ep0_buf;
m66592->ep0_req->length = 2;
+ /* AV: what happens if we get called again before that gets through? */
m66592_queue(m66592->gadget.ep0, m66592->ep0_req, GFP_KERNEL);
}
@@ -1254,24 +1255,6 @@ static void m66592_free_request(struct usb_ep *_ep, struct usb_request *_req)
kfree(req);
}
-static void *m66592_alloc_buffer(struct usb_ep *_ep, unsigned bytes,
- dma_addr_t *dma, gfp_t gfp_flags)
-{
- void *buf;
-
- buf = kzalloc(bytes, gfp_flags);
- if (dma)
- *dma = virt_to_bus(buf);
-
- return buf;
-}
-
-static void m66592_free_buffer(struct usb_ep *_ep, void *buf,
- dma_addr_t dma, unsigned bytes)
-{
- kfree(buf);
-}
-
static int m66592_queue(struct usb_ep *_ep, struct usb_request *_req,
gfp_t gfp_flags)
{
@@ -1378,9 +1361,6 @@ static struct usb_ep_ops m66592_ep_ops = {
.alloc_request = m66592_alloc_request,
.free_request = m66592_free_request,
- .alloc_buffer = m66592_alloc_buffer,
- .free_buffer = m66592_free_buffer,
-
.queue = m66592_queue,
.dequeue = m66592_dequeue,
@@ -1603,11 +1583,12 @@ static int __init m66592_probe(struct platform_device *pdev)
the_controller = m66592;
+ /* AV: leaks */
m66592->ep0_req = m66592_alloc_request(&m66592->ep[0].ep, GFP_KERNEL);
if (m66592->ep0_req == NULL)
goto clean_up;
- m66592->ep0_buf = m66592_alloc_buffer(&m66592->ep[0].ep, 2, NULL,
- GFP_KERNEL);
+ /* AV: leaks, and do we really need it separately allocated? */
+ m66592->ep0_buf = kzalloc(2, GFP_KERNEL);
if (m66592->ep0_buf == NULL)
goto clean_up;
--
1.5.3.GIT
next reply other threads:[~2007-07-15 19:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-15 19:59 Al Viro [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-07-15 23:07 [PATCH] minimal fixes for drivers/usb/gadget/m66592-udc.c David Brownell
2007-07-15 23:18 ` David Brownell
2007-07-15 23:24 ` Al Viro
2007-07-16 2:54 ` David Brownell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1IAAFW-00053E-0T@ZenIV.linux.org.uk \
--to=viro@ftp.linux.org.uk \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox