Skip to content

Commit 67a8c1b

Browse files
Navidemgregkh
authored andcommitted
wimax: i2400: Fix memory leak in i2400m_op_rfkill_sw_toggle
commit 6f3ef5c 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: 2507e6a ("wimax: i2400: fix memory leak") Signed-off-by: Navid Emamdoost <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Ben Hutchings <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent cae904f commit 67a8c1b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/wimax/i2400m/op-rfkill.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@ int i2400m_op_rfkill_sw_toggle(struct wimax_dev *wimax_dev,
142142
"%d\n", result);
143143
result = 0;
144144
error_cmd:
145-
kfree(cmd);
146145
kfree_skb(ack_skb);
147146
error_msg_to_dev:
148147
error_alloc:
149148
d_fnend(4, dev, "(wimax_dev %p state %d) = %d\n",
150149
wimax_dev, state, result);
150+
kfree(cmd);
151151
return result;
152152
}
153153

0 commit comments

Comments
 (0)