From: Robert Baldyga <r.baldyga@samsung.com>
Date: Fri, 27 Sep 2013 10:28:54 +0000 (+0200)
Subject: usb: gadget: f_fs: fix error handling
X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=8854894c040cd68b463dccf267308250b336df40;p=linux.git

usb: gadget: f_fs: fix error handling

This patch add missing error check in ffs_func_bind() function, after
ffs_do_descs() function call for high speed descriptors. Without this
check it's possible that the module will try dereference incorrect
pointer.

[ balbi@ti.com : removed trailing empty line ]

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---

diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 1a66c5baa0d1f..0da66bacb0d43 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -2264,6 +2264,8 @@ 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;
 	}
 
 	/*