aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/file_storage.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/file_storage.c')
-rw-r--r--drivers/usb/gadget/file_storage.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index 1ab9dac7e12d..33bb76cef33c 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -1711,7 +1711,9 @@ static int do_write(struct fsg_dev *fsg)
1711 curlun->sense_data = SS_WRITE_PROTECTED; 1711 curlun->sense_data = SS_WRITE_PROTECTED;
1712 return -EINVAL; 1712 return -EINVAL;
1713 } 1713 }
1714 spin_lock(&curlun->filp->f_lock);
1714 curlun->filp->f_flags &= ~O_SYNC; // Default is not to wait 1715 curlun->filp->f_flags &= ~O_SYNC; // Default is not to wait
1716 spin_unlock(&curlun->filp->f_lock);
1715 1717
1716 /* Get the starting Logical Block Address and check that it's 1718 /* Get the starting Logical Block Address and check that it's
1717 * not too big */ 1719 * not too big */
@@ -1728,8 +1730,11 @@ static int do_write(struct fsg_dev *fsg)
1728 curlun->sense_data = SS_INVALID_FIELD_IN_CDB; 1730 curlun->sense_data = SS_INVALID_FIELD_IN_CDB;
1729 return -EINVAL; 1731 return -EINVAL;
1730 } 1732 }
1731 if (fsg->cmnd[1] & 0x08) // FUA 1733 if (fsg->cmnd[1] & 0x08) { // FUA
1734 spin_lock(&curlun->filp->f_lock);
1732 curlun->filp->f_flags |= O_SYNC; 1735 curlun->filp->f_flags |= O_SYNC;
1736 spin_unlock(&curlun->filp->f_lock);
1737 }
1733 } 1738 }
1734 if (lba >= curlun->num_sectors) { 1739 if (lba >= curlun->num_sectors) {
1735 curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; 1740 curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE;