All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Opasiak <k.opasiak@samsung.com>
To: Alan Stern <stern@rowland.harvard.edu>,
	Michal Nazarewicz <mina86@mina86.com>
Cc: balbi@ti.com, stable@vger.kernel.org, david.fisher1@synopsys.com,
	gregkh@linuxfoundation.org, andrzej.p@samsung.com,
	m.szyprowski@samsung.com, linux-usb@vger.kernel.org
Subject: Re: [PATCH 2/5] usb: gadget: mass_storage: Enforce contiguous LUN ids
Date: Wed, 24 Jun 2015 18:01:58 +0200	[thread overview]
Message-ID: <558AD476.6090708@samsung.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1506221044500.1799-100000@iolanthe.rowland.org>



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@samsung.com>
>>
>> Acked-by: Michal Nazarewicz <mina86@mina86.com>
>>
>> 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

  reply	other threads:[~2015-06-24 16:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-22 13:19 [PATCH 0/5] Mass storage fixes and improvements Krzysztof Opasiak
2015-06-22 13:19 ` [PATCH 1/5] usb: gadget: mass_storage: Free buffers if create lun fails Krzysztof Opasiak
2015-06-22 14:27   ` Michal Nazarewicz
2015-06-22 13:19 ` [PATCH 2/5] usb: gadget: mass_storage: Enforce contiguous LUN ids Krzysztof Opasiak
2015-06-22 14:31   ` Michal Nazarewicz
2015-06-22 14:45     ` Alan Stern
2015-06-24 16:01       ` Krzysztof Opasiak [this message]
2015-06-22 13:19 ` [PATCH 3/5] usb: gadget: mass_storage: Place EXPORT_SYMBOL_GPL() after func definition Krzysztof Opasiak
2015-06-22 14:31   ` Michal Nazarewicz
2015-06-22 13:19 ` [PATCH 4/5] usb: gadget: storage-common: Set FSG_MAX_LUNS to 16 Krzysztof Opasiak
2015-06-22 14:32   ` Michal Nazarewicz
2015-06-22 13:19 ` [PATCH 5/5] usb: gadget: mass_storage: Send correct number of LUNs to host Krzysztof Opasiak
2015-06-22 14:34   ` Michal Nazarewicz
2015-06-22 14:42     ` Krzysztof Opasiak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=558AD476.6090708@samsung.com \
    --to=k.opasiak@samsung.com \
    --cc=andrzej.p@samsung.com \
    --cc=balbi@ti.com \
    --cc=david.fisher1@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mina86@mina86.com \
    --cc=stable@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.