]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb: gadget: Zero ffs_io_data
authorAndrzej Pietrasiewicz <andrzej.p@collabora.com>
Mon, 3 Jun 2019 17:05:28 +0000 (19:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Aug 2019 07:34:57 +0000 (09:34 +0200)
commit959c7313967990e5a9eff4604abaa8bff4e6f8f9
tree8183e07ffc93de450ed98300ecefe3bbca019e8f
parent718514c02cc9d43b9e2d9b62c22aae9e05e47c39
usb: gadget: Zero ffs_io_data

[ Upstream commit 508595515f4bcfe36246e4a565cf280937aeaade ]

In some cases the "Allocate & copy" block in ffs_epfile_io() is not
executed. Consequently, in such a case ffs_alloc_buffer() is never called
and struct ffs_io_data is not initialized properly. This in turn leads to
problems when ffs_free_buffer() is called at the end of ffs_epfile_io().

This patch uses kzalloc() instead of kmalloc() in the aio case and memset()
in non-aio case to properly initialize struct ffs_io_data.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/gadget/function/f_fs.c