usb: gadget: mass_storage: make "file" and "ro" read only in some cases
authorMichal Nazarewicz <mina86@mina86.com>
Mon, 25 Jun 2012 14:40:22 +0000 (16:40 +0200)
committerFelipe Balbi <balbi@ti.com>
Mon, 2 Jul 2012 07:36:55 +0000 (10:36 +0300)
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>
drivers/usb/gadget/f_mass_storage.c
drivers/usb/gadget/storage_common.c

Simple merge
Simple merge