summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/f_fs.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-24 12:33:52 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-24 12:33:52 -0800
commitb42060069faa0daf7915acec4f31e4a46bca3b32 (patch)
treee403a7948aedea5897fd3118da0ff1c9926690a7 /drivers/usb/gadget/f_fs.c
parentaa256f8d0dd9c2dff872849418d8e09e5d06718f (diff)
parentcfbf8d4857c26a8a307fb7cd258074c9dcd8c691 (diff)
Merge 3.14-rc4 into staging-next.
We want those fixes here as well.
Diffstat (limited to 'drivers/usb/gadget/f_fs.c')
-rw-r--r--drivers/usb/gadget/f_fs.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 306a2b52125c..2b4334394076 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -585,7 +585,6 @@ static ssize_t ffs_epfile_io(struct file *file,
char __user *buf, size_t len, int read)
{
struct ffs_epfile *epfile = file->private_data;
- struct usb_gadget *gadget = epfile->ffs->gadget;
struct ffs_ep *ep;
char *data = NULL;
ssize_t ret, data_len;
@@ -622,6 +621,12 @@ static ssize_t ffs_epfile_io(struct file *file,
/* Allocate & copy */
if (!halt) {
/*
+ * if we _do_ wait above, the epfile->ffs->gadget might be NULL
+ * before the waiting completes, so do not assign to 'gadget' earlier
+ */
+ struct usb_gadget *gadget = epfile->ffs->gadget;
+
+ /*
* Controller may require buffer size to be aligned to
* maxpacketsize of an out endpoint.
*/