Re: [PATCH 2/5] usb: gadget: mass_storage: Enforce contiguous LUN ids

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

 





On 06/22/2015 04:45 PM, Alan Stern wrote:
On Mon, 22 Jun 2015, Michal Nazarewicz wrote:

On Mon, Jun 22 2015, Krzysztof Opasiak wrote:
According to mass storage specification:

"Logical Unit Numbers on the device shall be numbered contiguously
  starting from LUN 0 to a maximum LUN of 15 (Fh)"

So don't allow to bind ms function unless we have at least LUN0
and LUNs ids are contiguous.

Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>

Acked-by: Michal Nazarewicz <mina86@xxxxxxxxxx>

but then again I think that we should let user space shoot themselves in
the foot if they want to, especially as letting them to that is less
code. ;)


It's a little bit philosophical problem about "Should we validate user configuration and data?". A good example may be validating MAC provided by user. Not doing this will also reduce the amount of code but we return error and notify user instead of making up how to interpret some invalid data.

Problem with not contiguous LUNs is that some hosts (in particular Linux) stop discovering them when they find first invalid LUN. So if we allocate LUNs 0, 1, 2, 7, 8, Linux host (at least the one tested by me) will see only first three of them and of course it comply with spec which says that LUNs should be contiguous. (Windows is not so restrictive and continues until value returned from Get Max LUN)


How about logging a warning message if the LUNs aren't contiguous but
then continuing on?  Like we do if the serial number string isn't
provided.

I think that a good log message is much better than nothing;)

If there is no agreement on enforcing contiguous LUNs I will update the patches and print some warn instead of returning error.

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



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]