Commit 7eaf5077b37bb33dbd44e569ff88566d6fe286e9
Committed by
David S. Miller
1 parent
5dba93aedf
Exists in
master
and in
20 other branches
net: fix double skb free in dcbnl
netlink_unicast() calls kfree_skb even in the error case. dcbnl calls netlink_unicast() which when it fails free's the skb and returns an error value. dcbnl is free'ing the skb again when this error occurs. This patch removes the double free. Signed-off-by: John Fastabend <john.r.fastabend@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 7 additions and 8 deletions Side-by-side Diff
net/dcb/dcbnl.c
... | ... | @@ -194,7 +194,7 @@ |
194 | 194 | nlmsg_end(dcbnl_skb, nlh); |
195 | 195 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); |
196 | 196 | if (ret) |
197 | - goto err; | |
197 | + return -EINVAL; | |
198 | 198 | |
199 | 199 | return 0; |
200 | 200 | nlmsg_failure: |
... | ... | @@ -275,7 +275,7 @@ |
275 | 275 | |
276 | 276 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); |
277 | 277 | if (ret) |
278 | - goto err; | |
278 | + goto err_out; | |
279 | 279 | |
280 | 280 | return 0; |
281 | 281 | nlmsg_failure: |
282 | 282 | |
... | ... | @@ -316,12 +316,11 @@ |
316 | 316 | |
317 | 317 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); |
318 | 318 | if (ret) |
319 | - goto err; | |
319 | + goto err_out; | |
320 | 320 | |
321 | 321 | return 0; |
322 | 322 | |
323 | 323 | nlmsg_failure: |
324 | -err: | |
325 | 324 | kfree_skb(dcbnl_skb); |
326 | 325 | err_out: |
327 | 326 | return -EINVAL; |
... | ... | @@ -383,7 +382,7 @@ |
383 | 382 | |
384 | 383 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); |
385 | 384 | if (ret) |
386 | - goto err; | |
385 | + goto err_out; | |
387 | 386 | |
388 | 387 | return 0; |
389 | 388 | nlmsg_failure: |
... | ... | @@ -460,7 +459,7 @@ |
460 | 459 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); |
461 | 460 | if (ret) { |
462 | 461 | ret = -EINVAL; |
463 | - goto err; | |
462 | + goto err_out; | |
464 | 463 | } |
465 | 464 | |
466 | 465 | return 0; |
... | ... | @@ -799,7 +798,7 @@ |
799 | 798 | |
800 | 799 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); |
801 | 800 | if (ret) |
802 | - goto err; | |
801 | + goto err_out; | |
803 | 802 | |
804 | 803 | return 0; |
805 | 804 | |
... | ... | @@ -1063,7 +1062,7 @@ |
1063 | 1062 | |
1064 | 1063 | ret = rtnl_unicast(dcbnl_skb, &init_net, pid); |
1065 | 1064 | if (ret) |
1066 | - goto err; | |
1065 | + goto err_out; | |
1067 | 1066 | |
1068 | 1067 | return 0; |
1069 | 1068 |