diff options
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/ip_sockglue.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 51c6c672c8aa..0d11f234d615 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -673,10 +673,15 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
673 | break; | 673 | break; |
674 | } else { | 674 | } else { |
675 | memset(&mreq, 0, sizeof(mreq)); | 675 | memset(&mreq, 0, sizeof(mreq)); |
676 | if (optlen >= sizeof(struct in_addr) && | 676 | if (optlen >= sizeof(struct ip_mreq)) { |
677 | copy_from_user(&mreq.imr_address, optval, | 677 | if (copy_from_user(&mreq, optval, |
678 | sizeof(struct in_addr))) | 678 | sizeof(struct ip_mreq))) |
679 | break; | 679 | break; |
680 | } else if (optlen >= sizeof(struct in_addr)) { | ||
681 | if (copy_from_user(&mreq.imr_address, optval, | ||
682 | sizeof(struct in_addr))) | ||
683 | break; | ||
684 | } | ||
680 | } | 685 | } |
681 | 686 | ||
682 | if (!mreq.imr_ifindex) { | 687 | if (!mreq.imr_ifindex) { |