diff options
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/dev.c | 7 | ||||
-rw-r--r-- | net/core/sock.c | 5 |
2 files changed, 9 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 08dec6eb922b..e0489ca731c5 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -977,7 +977,12 @@ int register_netdevice_notifier(struct notifier_block *nb) | |||
977 | 977 | ||
978 | int unregister_netdevice_notifier(struct notifier_block *nb) | 978 | int unregister_netdevice_notifier(struct notifier_block *nb) |
979 | { | 979 | { |
980 | return notifier_chain_unregister(&netdev_chain, nb); | 980 | int err; |
981 | |||
982 | rtnl_lock(); | ||
983 | err = notifier_chain_unregister(&netdev_chain, nb); | ||
984 | rtnl_unlock(); | ||
985 | return err; | ||
981 | } | 986 | } |
982 | 987 | ||
983 | /** | 988 | /** |
diff --git a/net/core/sock.c b/net/core/sock.c index 1a7e6eac90b0..e110b9004147 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -404,8 +404,9 @@ set_rcvbuf: | |||
404 | if (!valbool) { | 404 | if (!valbool) { |
405 | sk->sk_bound_dev_if = 0; | 405 | sk->sk_bound_dev_if = 0; |
406 | } else { | 406 | } else { |
407 | if (optlen > IFNAMSIZ) | 407 | if (optlen > IFNAMSIZ - 1) |
408 | optlen = IFNAMSIZ; | 408 | optlen = IFNAMSIZ - 1; |
409 | memset(devname, 0, sizeof(devname)); | ||
409 | if (copy_from_user(devname, optval, optlen)) { | 410 | if (copy_from_user(devname, optval, optlen)) { |
410 | ret = -EFAULT; | 411 | ret = -EFAULT; |
411 | break; | 412 | break; |