Re: [PATCH] usb/gadget: FunctionFS: Fix enable multiple instances

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 11 2013, Andrzej Pietrasiewicz wrote:
> This patch fixes an "off-by-one" bug found in
> 581791f5c7a480b2cc3431af9a6e799ffd51eb5e.
> During gfs_bind/gfs_unbind the functionfs_bind/functionfs_unbind should be
> called for every functionfs instance. With the "i" pre-decremented they
> were not called for the zeroth instance.
>
> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxx>
> Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
> Cc: <stable@xxxxxxxxxxxxxxx>

Acked-by: Michal Nazarewicz <mina86@xxxxxxxxxx>

> ---
>  drivers/usb/gadget/g_ffs.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c
> index d3ace90..919177b 100644
> --- a/drivers/usb/gadget/g_ffs.c
> +++ b/drivers/usb/gadget/g_ffs.c
> @@ -358,7 +358,7 @@ static int gfs_bind(struct usb_composite_dev *cdev)
>  	if (unlikely(ret < 0))
>  		goto error;
>  
> -	for (i = func_num; --i; ) {
> +	for (i = func_num; i--; ) {
>  		ret = functionfs_bind(ffs_tab[i].ffs_data, cdev);
>  		if (unlikely(ret < 0)) {
>  			while (++i < func_num)
> @@ -413,7 +413,7 @@ static int gfs_unbind(struct usb_composite_dev *cdev)
>  		gether_cleanup();
>  	gfs_ether_setup = false;
>  
> -	for (i = func_num; --i; )
> +	for (i = func_num; i--; )
>  		if (ffs_tab[i].ffs_data)
>  			functionfs_unbind(ffs_tab[i].ffs_data);
>  
> -- 
> 1.7.0.4
>

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +----<email/xmpp: mpn@xxxxxxxxxx>--------------ooO--(_)--Ooo--

Attachment: pgp8ZIwUhIFz9.pgp
Description: PGP signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux