Skip to content

Commit

Permalink
wimax: i2400: Fix memory leak in i2400m_op_rfkill_sw_toggle
Browse files Browse the repository at this point in the history
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: 2507e6a ("wimax: i2400: fix memory leak")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Navidem authored and davem330 committed Oct 29, 2019
1 parent 63a4174 commit 6f3ef5c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/wimax/i2400m/op-rfkill.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 6f3ef5c

Please sign in to comment.