wimax: i2400: Fix memory leak in i2400m_op_rfkill_sw_toggle
authorNavid Emamdoost <navid.emamdoost@gmail.com>
Sat, 26 Oct 2019 04:53:30 +0000 (23:53 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Mar 2020 10:55:57 +0000 (11:55 +0100)
commitdfb827019bcc6d549cf9265185eacf67c391b42d
tree3bbd4ee2f720421dc7e417ce72ee334dcc942bbb
parentdd5a14630d81827520f19b669625033105e05475
wimax: i2400: Fix memory leak in i2400m_op_rfkill_sw_toggle

[ Upstream commit 6f3ef5c25cc762687a7341c18cbea5af54461407 ]

In the implementation of i2400m_op_rfkill_sw_toggle() the allocated
buffer for cmd should be released before returning. The
documentation for i2400m_msg_to_dev() says when it returns the buffer
can be reused. Meaning cmd should be released in either case. Move
kfree(cmd) before return to be reached by all execution paths.

Fixes: 2507e6ab7a9a ("wimax: i2400: fix memory leak")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wimax/i2400m/op-rfkill.c