usb: gadget: Zero ffs_io_data
authorAndrzej Pietrasiewicz <andrzej.p@collabora.com>
Mon, 3 Jun 2019 17:05:28 +0000 (19:05 +0200)
committerlingsen1 <lingsen1@lenovo.com>
Fri, 22 Nov 2019 05:45:30 +0000 (13:45 +0800)
commit230e066719e81ccc883ad79212f7f605a52e9fe8
tree74be5629c44acd4c548aa58623275542be8fe26b
parentbbc3edbb781dd58c72cfad7a4f3d87aee297e33f
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.

Change-Id: I9a9f0af8cf2b842dc84ba0cb0225957b183a3357
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>
Signed-off-by: Kisang Lee <kisang80.lee@samsung.com>
drivers/usb/gadget/function/f_fs.c