]> git.baikalelectronics.ru Git - kernel.git/commitdiff
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)
committerDavid S. Miller <davem@davemloft.net>
Tue, 29 Oct 2019 23:20:25 +0000 (16:20 -0700)
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: e9c22d1b9981 ("wimax: i2400: fix memory leak")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wimax/i2400m/op-rfkill.c

index 8efb493ceec2fc96cda43cb56cde5e6d19e91015..5c79f052cad20925c63e6c72adda3a97af3ee0fd 100644 (file)
@@ -127,12 +127,12 @@ int i2400m_op_rfkill_sw_toggle(struct wimax_dev *wimax_dev,
                        "%d\n", result);
        result = 0;
 error_cmd:
-       kfree(cmd);
        kfree_skb(ack_skb);
 error_msg_to_dev:
 error_alloc:
        d_fnend(4, dev, "(wimax_dev %p state %d) = %d\n",
                wimax_dev, state, result);
+       kfree(cmd);
        return result;
 }