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>
Thu, 23 Jan 2020 07:19:34 +0000 (08:19 +0100)
commit7c41a8662b6bab58eee8c2e8c6083efd5050f167
tree5fe21779e43c9597397f6da258d55782621f04c2
parent49fcab52e6417db027aad6310dd851a2f5ef3f30
wimax: i2400: Fix memory leak in i2400m_op_rfkill_sw_toggle

commit 6f3ef5c25cc762687a7341c18cbea5af54461407 upstream.

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: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wimax/i2400m/op-rfkill.c