Skip to content

Commit

Permalink
Merge branch 'diag-raw-fixes'
Browse files Browse the repository at this point in the history
Cyrill Gorcunov says:

====================
net: Fixes for raw diag sockets handling

Hi! Here are a few fixes for raw-diag sockets handling: missing
sock_put call and jump for exiting from nested cycle. I made
patches for iproute2 as well so will send them out soon.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Nov 3, 2016
2 parents 1719723 + 9999370 commit d3bc29a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions net/ipv4/raw_diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ static struct sock *raw_sock_get(struct net *net, const struct inet_diag_req_v2
* hashinfo->lock here.
*/
sock_hold(sk);
break;
goto out_unlock;
}
}
}
out_unlock:
read_unlock(&hashinfo->lock);

return sk ? sk : ERR_PTR(-ENOENT);
Expand Down Expand Up @@ -205,11 +206,14 @@ static int raw_diag_destroy(struct sk_buff *in_skb,
{
struct net *net = sock_net(in_skb->sk);
struct sock *sk;
int err;

sk = raw_sock_get(net, r);
if (IS_ERR(sk))
return PTR_ERR(sk);
return sock_diag_destroy(sk, ECONNABORTED);
err = sock_diag_destroy(sk, ECONNABORTED);
sock_put(sk);
return err;
}
#endif

Expand Down

0 comments on commit d3bc29a

Please sign in to comment.