mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 23:34:05 +08:00
usb: gadget: f_fs: check for allocation failure
Return -ENOMEM if kmalloc() fails.
Fixes: 9353afbbfa
('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>
This commit is contained in:
parent
e43470dbdf
commit
44963d649d
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user