All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@mvista.com>
To: Michal Nazarewicz <mpn@google.com>
Cc: Felipe Balbi <balbi@ti.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] usb: gadget: mass_storage: require backing file for non-removable LUNs
Date: Tue, 19 Jun 2012 15:12:16 +0400	[thread overview]
Message-ID: <4FE05E90.6000307@mvista.com> (raw)
In-Reply-To: <593bff689c31fefb07534e3f500d8a8c29fcdacb.1340022674.git.mina86@mina86.com>

Hello.

On 18-06-2012 16:37, Michal Nazarewicz wrote:

> From: Michal Nazarewicz<mina86@mina86.com>

> The fsg_file_store()

    Apparently, fsg_store_file(), judging by the patch itself.

> function does not check whether a LUN is removable or not
> allowing one to specify an empty file name for a non-removable LUN.  This
> commit adds explicit check of whether a file name is provided for
> non-removable LUNs.

> Signed-off-by: Michal Nazarewicz<mina86@mina86.com>
> ---
>   drivers/usb/gadget/storage_common.c |    3 +++
>   1 files changed, 3 insertions(+), 0 deletions(-)

> diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c
> index e576678..52334d7 100644
> --- a/drivers/usb/gadget/storage_common.c
> +++ b/drivers/usb/gadget/storage_common.c
> @@ -878,6 +878,9 @@ static ssize_t fsg_store_file(struct device *dev, struct device_attribute *attr,
>   	if (count > 0 && buf[count-1] == '\n')
>   		((char *) buf)[count-1] = 0;		/* Ugh! */
>
> +	/* Must specify a valid file if LUN is not removable. */
> +	if (!curlun->removable&&  !*buf)
> +		return -EINVAL;

WBR, Sergei

      parent reply	other threads:[~2012-06-19 11:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-18 12:37 [PATCH 0/3] A few mass_storage fixes Michal Nazarewicz
2012-06-18 12:37 ` [PATCH 1/3] usb: gadget: storage_common: remove FSG_BUFFHD_STATIC_BUFFER support Michal Nazarewicz
2012-06-18 12:37 ` [PATCH 2/3] usb: gadget: mass_storage: fail fsg_store_file() early if colud not open file Michal Nazarewicz
2012-06-18 14:20   ` Alan Stern
2012-06-18 12:37 ` [PATCH 3/3] usb: gadget: mass_storage: require backing file for non-removable LUNs Michal Nazarewicz
2012-06-18 14:18   ` Alan Stern
2012-06-18 15:32     ` Michal Nazarewicz
2012-06-19 11:12   ` Sergei Shtylyov [this message]

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=4FE05E90.6000307@mvista.com \
    --to=sshtylyov@mvista.com \
    --cc=balbi@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mpn@google.com \
    --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.