* [PATCH] USB: gadget: f_fs: fix error handling
@ 2013-09-27 10:28 Robert Baldyga
2013-09-27 14:05 ` Michal Nazarewicz
2013-09-27 18:20 ` Sergei Shtylyov
0 siblings, 2 replies; 3+ messages in thread
From: Robert Baldyga @ 2013-09-27 10:28 UTC (permalink / raw)
To: balbi
Cc: gregkh, linux-usb, linux-kernel, mina86, b.zolnierkie,
m.szyprowski, andrzej.p, Robert Baldyga
This patch add missing error check in ffs_func_bind() function, after
ffs_do_descs() funcion call for hs descriptors. Without this check it's
possible that the module will try dereference incorrect pointer.
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
---
drivers/usb/gadget/f_fs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 1a66c5b..fe7d532 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -2264,7 +2264,10 @@ static int ffs_func_bind(struct usb_configuration *c,
data->raw_descs + ret,
(sizeof data->raw_descs) - ret,
__ffs_func_bind_do_descs, func);
+ if (unlikely(ret < 0))
+ goto error;
}
+
/*
* Now handle interface numbers allocation and interface and
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] USB: gadget: f_fs: fix error handling
2013-09-27 10:28 [PATCH] USB: gadget: f_fs: fix error handling Robert Baldyga
@ 2013-09-27 14:05 ` Michal Nazarewicz
2013-09-27 18:20 ` Sergei Shtylyov
1 sibling, 0 replies; 3+ messages in thread
From: Michal Nazarewicz @ 2013-09-27 14:05 UTC (permalink / raw)
To: Robert Baldyga, balbi
Cc: gregkh, linux-usb, linux-kernel, b.zolnierkie, m.szyprowski,
andrzej.p, Robert Baldyga
[-- Attachment #1: Type: text/plain, Size: 1312 bytes --]
On Fri, Sep 27 2013, Robert Baldyga wrote:
> This patch add missing error check in ffs_func_bind() function, after
> ffs_do_descs() funcion call for hs descriptors. Without this check it's
> possible that the module will try dereference incorrect pointer.
>
> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
> ---
> drivers/usb/gadget/f_fs.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
> index 1a66c5b..fe7d532 100644
> --- a/drivers/usb/gadget/f_fs.c
> +++ b/drivers/usb/gadget/f_fs.c
> @@ -2264,7 +2264,10 @@ static int ffs_func_bind(struct usb_configuration *c,
> data->raw_descs + ret,
> (sizeof data->raw_descs) - ret,
> __ffs_func_bind_do_descs, func);
> + if (unlikely(ret < 0))
> + goto error;
> }
> +
This new line with only a tab in it is not needed here though.
>
> /*
> * Now handle interface numbers allocation and interface and
--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michał “mina86” Nazarewicz (o o)
ooo +--<mpn@google.com>--<xmpp:mina86@jabber.org>--ooO--(_)--Ooo--
[-- Attachment #2.1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] USB: gadget: f_fs: fix error handling
2013-09-27 10:28 [PATCH] USB: gadget: f_fs: fix error handling Robert Baldyga
2013-09-27 14:05 ` Michal Nazarewicz
@ 2013-09-27 18:20 ` Sergei Shtylyov
1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2013-09-27 18:20 UTC (permalink / raw)
To: Robert Baldyga
Cc: balbi, gregkh, linux-usb, linux-kernel, mina86, b.zolnierkie,
m.szyprowski, andrzej.p
Hello.
On 09/27/2013 02:28 PM, Robert Baldyga wrote:
> This patch add missing error check in ffs_func_bind() function, after
> ffs_do_descs() funcion call for hs descriptors. Without this check it's
s/funcion/function/.
Perhaps it's worth expanding "hs" to "high speed" for clarity?
> possible that the module will try dereference incorrect pointer.
> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
> ---
> drivers/usb/gadget/f_fs.c | 3 +++
> 1 file changed, 3 insertions(+)
> diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
> index 1a66c5b..fe7d532 100644
> --- a/drivers/usb/gadget/f_fs.c
> +++ b/drivers/usb/gadget/f_fs.c
> @@ -2264,7 +2264,10 @@ static int ffs_func_bind(struct usb_configuration *c,
> data->raw_descs + ret,
> (sizeof data->raw_descs) - ret,
> __ffs_func_bind_do_descs, func);
> + if (unlikely(ret < 0))
> + goto error;
> }
> +
>
Why add second empty line here?
> /*
> * Now handle interface numbers allocation and interface and
WBR, Sergei
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-09-27 18:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-27 10:28 [PATCH] USB: gadget: f_fs: fix error handling Robert Baldyga
2013-09-27 14:05 ` Michal Nazarewicz
2013-09-27 18:20 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox