diff options
author | David S. Miller <davem@davemloft.net> | 2020-01-26 12:40:21 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-01-26 12:40:21 +0300 |
commit | 4d8773b68e83558025303f266070b31bc4101e73 (patch) | |
tree | 151cafa469fbc6a411d36b58ab802f67869cc0bb /drivers/net/gtp.c | |
parent | 3333e50b64fe30b7e53cf02456a2f567f689ae4f (diff) | |
parent | 2821e26f3a0a3872184581caac8115bb02641941 (diff) | |
download | linux-4d8773b68e83558025303f266070b31bc4101e73.tar.xz |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Minor conflict in mlx5 because changes happened to code that has
moved meanwhile.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/gtp.c')
-rw-r--r-- | drivers/net/gtp.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c index bc85db8e6cdf..7032a2405e1a 100644 --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c @@ -804,19 +804,21 @@ static struct sock *gtp_encap_enable_socket(int fd, int type, return NULL; } - if (sock->sk->sk_protocol != IPPROTO_UDP) { + sk = sock->sk; + if (sk->sk_protocol != IPPROTO_UDP || + sk->sk_type != SOCK_DGRAM || + (sk->sk_family != AF_INET && sk->sk_family != AF_INET6)) { pr_debug("socket fd=%d not UDP\n", fd); sk = ERR_PTR(-EINVAL); goto out_sock; } - lock_sock(sock->sk); - if (sock->sk->sk_user_data) { + lock_sock(sk); + if (sk->sk_user_data) { sk = ERR_PTR(-EBUSY); goto out_rel_sock; } - sk = sock->sk; sock_hold(sk); tuncfg.sk_user_data = gtp; |