• Michal Nazarewicz's avatar
    usb: gadget: mass_storage: make "file" and "ro" read only in some cases · 48a31af7
    Michal Nazarewicz authored
    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: default avatarMichal Nazarewicz <mina86@mina86.com>
    Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
    48a31af7
storage_common.c 23.6 KB