summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-06-24 15:23:16 +0300
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-06-29 11:13:33 +0300
commit44963d649da63ce8ed8f41b8a267c745ca1ec0b0 (patch)
tree1c0e079d1c65a465ad9b98732b7db426dec239d5 /drivers/usb
parente43470dbdfe8922f9b2962184336efaa71e59727 (diff)
downloadlinux-44963d649da63ce8ed8f41b8a267c745ca1ec0b0.tar.bz2
usb: gadget: f_fs: check for allocation failure
Return -ENOMEM if kmalloc() fails. Fixes: 9353afbbfa7b ('usb: gadget: f_fs: buffer data from ‘oversized’ OUT requests') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/function/f_fs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index a91fcb0475b2..5c8429f23a89 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -775,6 +775,8 @@ static ssize_t __ffs_epfile_read_data(struct ffs_epfile *epfile,
data_len -= ret;
buf = kmalloc(sizeof(*buf) + data_len, GFP_KERNEL);
+ if (!buf)
+ return -ENOMEM;
buf->length = data_len;
buf->data = buf->storage;
memcpy(buf->storage, data + ret, data_len);