diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2016-06-24 15:23:16 +0300 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2016-06-29 11:13:33 +0300 |
commit | 44963d649da63ce8ed8f41b8a267c745ca1ec0b0 (patch) | |
tree | 1c0e079d1c65a465ad9b98732b7db426dec239d5 /drivers/usb/gadget/function/f_fs.c | |
parent | e43470dbdfe8922f9b2962184336efaa71e59727 (diff) | |
download | op-kernel-dev-44963d649da63ce8ed8f41b8a267c745ca1ec0b0.zip op-kernel-dev-44963d649da63ce8ed8f41b8a267c745ca1ec0b0.tar.gz |
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/gadget/function/f_fs.c')
-rw-r--r-- | drivers/usb/gadget/function/f_fs.c | 2 |
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 a91fcb0..5c8429f 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); |