HID: intel_ish-hid: tx_buf memory leak on probe/remove
authorAnton Vasilyev <vasilyev@ispras.ru>
Wed, 1 Aug 2018 11:26:51 +0000 (14:26 +0300)
committerJiri Kosina <jkosina@suse.cz>
Thu, 2 Aug 2018 11:27:54 +0000 (13:27 +0200)
commit50fa92594a2bc76265f4bb357f9a25dd3bdb2c0a
treec5a30ab184359bf83808e116c5ef975330e4c0f5
parenta1e9a9c0dfe47a3f13734be489b7953a2f8bdd83
HID: intel_ish-hid: tx_buf memory leak on probe/remove

ish_dev_init() allocates 512*176 bytes memory for tx_buf and stores it at
&dev->wr_free_list_head.link list on ish_probe().
But there is no deallocation of this memory in ish_remove() and in
ish_probe() error path.
So current intel-ish-ipc provides 88 KB memory leak for each
probe/release.

The patch replaces kzalloc allocation by devm_kzalloc and removes
ishtp_device *dev deallocation by kfree.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/intel-ish-hid/ipc/ipc.c
drivers/hid/intel-ish-hid/ipc/pci-ish.c