diff options
-rw-r--r-- | drivers/net/pppol2tp.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c index 266e8b38fe10..ed8ead432d77 100644 --- a/drivers/net/pppol2tp.c +++ b/drivers/net/pppol2tp.c | |||
@@ -1326,12 +1326,14 @@ static struct sock *pppol2tp_prepare_tunnel_socket(int fd, u16 tunnel_id, | |||
1326 | goto err; | 1326 | goto err; |
1327 | } | 1327 | } |
1328 | 1328 | ||
1329 | sk = sock->sk; | ||
1330 | |||
1329 | /* Quick sanity checks */ | 1331 | /* Quick sanity checks */ |
1330 | err = -ESOCKTNOSUPPORT; | 1332 | err = -EPROTONOSUPPORT; |
1331 | if (sock->type != SOCK_DGRAM) { | 1333 | if (sk->sk_protocol != IPPROTO_UDP) { |
1332 | PRINTK(-1, PPPOL2TP_MSG_CONTROL, KERN_ERR, | 1334 | PRINTK(-1, PPPOL2TP_MSG_CONTROL, KERN_ERR, |
1333 | "tunl %hu: fd %d wrong type, got %d, expected %d\n", | 1335 | "tunl %hu: fd %d wrong protocol, got %d, expected %d\n", |
1334 | tunnel_id, fd, sock->type, SOCK_DGRAM); | 1336 | tunnel_id, fd, sk->sk_protocol, IPPROTO_UDP); |
1335 | goto err; | 1337 | goto err; |
1336 | } | 1338 | } |
1337 | err = -EAFNOSUPPORT; | 1339 | err = -EAFNOSUPPORT; |
@@ -1343,7 +1345,6 @@ static struct sock *pppol2tp_prepare_tunnel_socket(int fd, u16 tunnel_id, | |||
1343 | } | 1345 | } |
1344 | 1346 | ||
1345 | err = -ENOTCONN; | 1347 | err = -ENOTCONN; |
1346 | sk = sock->sk; | ||
1347 | 1348 | ||
1348 | /* Check if this socket has already been prepped */ | 1349 | /* Check if this socket has already been prepped */ |
1349 | tunnel = (struct pppol2tp_tunnel *)sk->sk_user_data; | 1350 | tunnel = (struct pppol2tp_tunnel *)sk->sk_user_data; |