]> git.baikalelectronics.ru Git - kernel.git/commit
ice: Fix potential memory leak in ice_gnss_tty_write()
authorYuan Can <yuancan@huawei.com>
Wed, 7 Dec 2022 08:55:02 +0000 (08:55 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:58:27 +0000 (11:58 +0100)
commita2cf3182326ee1b5f449114c16b403d1ce8f48b0
tree6c682cb80926a72864f16bb9ddc2c94b2efe0a8d
parentf7fb4055f721d83bb82dd730f07d855abc890c1f
ice: Fix potential memory leak in ice_gnss_tty_write()

[ Upstream commit f58985620f55580a07d40062c4115d8c9cf6ae27 ]

The ice_gnss_tty_write() return directly if the write_buf alloc failed,
leaking the cmd_buf.

Fix by free cmd_buf if write_buf alloc failed.

Fixes: 4a87d274321a ("ice: add write functionality for GNSS TTY")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/ice/ice_gnss.c