Skip to content

Commit

Permalink
sctp: remove redundant null check on asoc
Browse files Browse the repository at this point in the history
In sctp_err_lookup, goto out while the asoc is not NULL, so remove the
check NULL. Also, in sctp_err_finish which called by sctp_v4_err and
sctp_v6_err, they pass asoc to sctp_err_finish while the asoc is not
NULL, so remove the check.

Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
wangweidong authored and David S. Miller committed Dec 11, 2013
1 parent 6b1dd85 commit e477266
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions net/sctp/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,17 +536,15 @@ struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *skb,
return sk;

out:
if (asoc)
sctp_association_put(asoc);
sctp_association_put(asoc);
return NULL;
}

/* Common cleanup code for icmp/icmpv6 error handler. */
void sctp_err_finish(struct sock *sk, struct sctp_association *asoc)
{
sctp_bh_unlock_sock(sk);
if (asoc)
sctp_association_put(asoc);
sctp_association_put(asoc);
}

/*
Expand Down

0 comments on commit e477266

Please sign in to comment.