Skip to content

Commit cbcc607

Browse files
Arkadi Sharshevskydavem330
authored andcommitted
team: Fix double free in error path
The __send_and_alloc_skb() receives a skb ptr as a parameter but in case it fails the skb is not valid: - Send failed and released the skb internally. - Allocation failed. The current code tries to release the skb in case of failure which causes redundant freeing. Fixes: 9b00cf2 ("team: implement multipart netlink messages for options transfers") Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent cfda06d commit cbcc607

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/team/team.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2395,7 +2395,7 @@ static int team_nl_send_options_get(struct team *team, u32 portid, u32 seq,
23952395
if (!nlh) {
23962396
err = __send_and_alloc_skb(&skb, team, portid, send_func);
23972397
if (err)
2398-
goto errout;
2398+
return err;
23992399
goto send_done;
24002400
}
24012401

@@ -2681,7 +2681,7 @@ static int team_nl_send_port_list_get(struct team *team, u32 portid, u32 seq,
26812681
if (!nlh) {
26822682
err = __send_and_alloc_skb(&skb, team, portid, send_func);
26832683
if (err)
2684-
goto errout;
2684+
return err;
26852685
goto send_done;
26862686
}
26872687

0 commit comments

Comments
 (0)