Skip to content

Commit

Permalink
mctp: remove unnecessary check before calling kfree_skb()
Browse files Browse the repository at this point in the history
The skb will be checked inside kfree_skb(), so remove the
outside check.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20211130031243.768823-1-yangyingliang@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Yang Yingliang authored and Jakub Kicinski committed Dec 1, 2021
1 parent 196073f commit 5cfe53c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 1 addition & 2 deletions net/mctp/af_mctp.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,7 @@ static void mctp_sk_unhash(struct sock *sk)
trace_mctp_key_release(key, MCTP_TRACE_KEY_CLOSED);

spin_lock(&key->lock);
if (key->reasm_head)
kfree_skb(key->reasm_head);
kfree_skb(key->reasm_head);
key->reasm_head = NULL;
key->reasm_dead = true;
key->valid = false;
Expand Down
4 changes: 1 addition & 3 deletions net/mctp/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,7 @@ static void __mctp_key_unlock_drop(struct mctp_sk_key *key, struct net *net,
/* and one for the local reference */
mctp_key_unref(key);

if (skb)
kfree_skb(skb);

kfree_skb(skb);
}

#ifdef CONFIG_MCTP_FLOWS
Expand Down

0 comments on commit 5cfe53c

Please sign in to comment.