diff options
| author | phil.turnbull@oracle.com <phil.turnbull@oracle.com> | 2016-09-15 12:41:44 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2016-09-17 09:59:31 -0400 |
| commit | 8ab86c00e349cef9fb14719093a7f198bcc72629 (patch) | |
| tree | bf17b411a164736fca71a74b42b7067b25709bce /net/irda | |
| parent | 20c64d5cd5a2bdcdc8982a06cb05e5e1bd851a3d (diff) | |
irda: Free skb on irda_accept error path.
skb is not freed if newsk is NULL. Rework the error path so free_skb is
unconditionally called on function exit.
Fixes: c3ea9fa27413 ("[IrDA] af_irda: IRDA_ASSERT cleanups")
Signed-off-by: Phil Turnbull <phil.turnbull@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/irda')
| -rw-r--r-- | net/irda/af_irda.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index 8d2f7c9b491d..ccc244406fb9 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
| @@ -832,7 +832,7 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) | |||
| 832 | struct sock *sk = sock->sk; | 832 | struct sock *sk = sock->sk; |
| 833 | struct irda_sock *new, *self = irda_sk(sk); | 833 | struct irda_sock *new, *self = irda_sk(sk); |
| 834 | struct sock *newsk; | 834 | struct sock *newsk; |
| 835 | struct sk_buff *skb; | 835 | struct sk_buff *skb = NULL; |
| 836 | int err; | 836 | int err; |
| 837 | 837 | ||
| 838 | err = irda_create(sock_net(sk), newsock, sk->sk_protocol, 0); | 838 | err = irda_create(sock_net(sk), newsock, sk->sk_protocol, 0); |
| @@ -900,7 +900,6 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) | |||
| 900 | err = -EPERM; /* value does not seem to make sense. -arnd */ | 900 | err = -EPERM; /* value does not seem to make sense. -arnd */ |
| 901 | if (!new->tsap) { | 901 | if (!new->tsap) { |
| 902 | pr_debug("%s(), dup failed!\n", __func__); | 902 | pr_debug("%s(), dup failed!\n", __func__); |
| 903 | kfree_skb(skb); | ||
| 904 | goto out; | 903 | goto out; |
| 905 | } | 904 | } |
| 906 | 905 | ||
| @@ -919,7 +918,6 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) | |||
| 919 | /* Clean up the original one to keep it in listen state */ | 918 | /* Clean up the original one to keep it in listen state */ |
| 920 | irttp_listen(self->tsap); | 919 | irttp_listen(self->tsap); |
| 921 | 920 | ||
| 922 | kfree_skb(skb); | ||
| 923 | sk->sk_ack_backlog--; | 921 | sk->sk_ack_backlog--; |
| 924 | 922 | ||
| 925 | newsock->state = SS_CONNECTED; | 923 | newsock->state = SS_CONNECTED; |
| @@ -927,6 +925,7 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) | |||
| 927 | irda_connect_response(new); | 925 | irda_connect_response(new); |
| 928 | err = 0; | 926 | err = 0; |
| 929 | out: | 927 | out: |
| 928 | kfree_skb(skb); | ||
| 930 | release_sock(sk); | 929 | release_sock(sk); |
| 931 | return err; | 930 | return err; |
| 932 | } | 931 | } |
