Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 44963d64 authored by Dan Carpenter's avatar Dan Carpenter Committed by Felipe Balbi
Browse files

usb: gadget: f_fs: check for allocation failure



Return -ENOMEM if kmalloc() fails.

Fixes: 9353afbb ('usb: gadget: f_fs: buffer data from ‘oversized’ OUT requests')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarMichal Nazarewicz <mina86@mina86.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent e43470db
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);