aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ipv6_sockglue.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/ipv6_sockglue.c')
-rw-r--r--net/ipv6/ipv6_sockglue.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 68566de4bcc5..430454ee5ead 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -497,13 +497,17 @@ done:
497 goto e_inval; 497 goto e_inval;
498 498
499 if (val) { 499 if (val) {
500 struct net_device *dev;
501
500 if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != val) 502 if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != val)
501 goto e_inval; 503 goto e_inval;
502 504
503 if (__dev_get_by_index(net, val) == NULL) { 505 dev = dev_get_by_index(net, val);
506 if (!dev) {
504 retv = -ENODEV; 507 retv = -ENODEV;
505 break; 508 break;
506 } 509 }
510 dev_put(dev);
507 } 511 }
508 np->mcast_oif = val; 512 np->mcast_oif = val;
509 retv = 0; 513 retv = 0;