Re: [PATCH v3 1/2] usb: gadget: loopback: fix: Don't share qlen and buflen between instances

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

 





On 09/24/2015 06:51 PM, Felipe Balbi wrote:
On Thu, Sep 24, 2015 at 05:19:12PM +0200, Robert Baldyga wrote:
On 09/22/2015 08:40 PM, Krzysztof Opasiak wrote:
Each instance of loopback function may have different qlen
and buflen attributes values. When linking function to
configuration those values had been assigned to global
variables. Linking other instance to config overwrites those
values.

This commit moves those values to f_loopback structure
to avoid overwriting. Now each function has its own instance
of those values.

Cc: <stable@xxxxxxxxxxxxxxx> # 3.10+
Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>

Reviewed-by: Robert Baldyga <r.baldyga@xxxxxxxxxxx>

doesn't seem to fit stable IMO. Care to explain why you think we need
to backport this to v3.10+ ?


Let's consider following set of commands:

cd $CFS_ROOT/usb_gadget
mkdir g1
cd g1
mkdir functions/SourceSink.1
mkdir functions/SourceSink.2
echo 1024 > functions/SourceSink.1/buflen
echo 512 > functions/SourceSink.2/buflen
mkdir configs/c.1
ln -s functions/SourceSink.1 configs/c.1/
ln -s functions/SourceSink.2 configs/c.1/
echo $UDC > UDC

You assume that after executing this script you will get two instances of SourceSink functions and one of them will alloc requests buffers which has 1024 and second one which has only 512.

Unfortunately due to using global variables both of them are going to alloc only 512 bytes for each request. The same situation is with qlen. All instances are going to use attributes values from the last one in the system, even if they are in multiple gadgets.

In my opinion second patch in this series is much more important as it makes loopback function working again after almost year of being only /dev/null and /dev/zero. But that one should to go only to 3.18.

Best regards,
--
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



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

  Powered by Linux