Skip to content

Commit 6f3ef5c

Browse files
Navidemdavem330
authored andcommitted
wimax: i2400: Fix memory leak in i2400m_op_rfkill_sw_toggle
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]>
1 parent 63a4174 commit 6f3ef5c

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
@@ -127,12 +127,12 @@ int i2400m_op_rfkill_sw_toggle(struct wimax_dev *wimax_dev,
127127
"%d\n", result);
128128
result = 0;
129129
error_cmd:
130-
kfree(cmd);
131130
kfree_skb(ack_skb);
132131
error_msg_to_dev:
133132
error_alloc:
134133
d_fnend(4, dev, "(wimax_dev %p state %d) = %d\n",
135134
wimax_dev, state, result);
135+
kfree(cmd);
136136
return result;
137137
}
138138

0 commit comments

Comments
 (0)