summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/storage_common.c
diff options
context:
space:
mode:
authorMichal Nazarewicz <mina86@mina86.com>2012-06-25 16:40:22 +0200
committerFelipe Balbi <balbi@ti.com>2012-07-02 10:36:55 +0300
commit48a31af74404e6460eabca410bf0b4a625bfd372 (patch)
treec7fdff57313b6f4953ad798b8ba9c5796c45fb39 /drivers/usb/gadget/storage_common.c
parent31bde1ceaa873bcaecd49e829bfabceacc4c512d (diff)
usb: gadget: mass_storage: make "file" and "ro" read only in some cases
The “file” sysfs entry for LUNs was writable even for non-removable LUNs and the fsg_store_file() function did not check whether LUN is removable or not. This made it possible to change or even close LUN's backing file. The same is true for “ro” sysfs entry and LUNs simulating CD-ROM. For those LUNs, the file should not be writable. This commit introduces two new device_attribute structures for those two special cases so that the file/ro sysfs entries are made non-writable when not desired. Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/storage_common.c')
-rw-r--r--drivers/usb/gadget/storage_common.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c
index e576678fb621..ae8b18869b8c 100644
--- a/drivers/usb/gadget/storage_common.c
+++ b/drivers/usb/gadget/storage_common.c
@@ -878,7 +878,6 @@ 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! */
-
/* Load new medium */
down_write(filesem);
if (count > 0 && buf[0]) {