Re: [PATCH 1/2] ipv4: fix do_ip_setsockopt optlen check forIP_MULTICAST_IF

From: David Miller
Date: Thu Sep 24 2009 - 18:44:23 EST


From: Shan Wei <shanwei@xxxxxxxxxxxxxx>
Date: Wed, 23 Sep 2009 09:41:10 +0800

> [PATCH BUGFIX] ipv4: check optlen for IP_MULTICAST_IF option
>
> Due to man page of setsockopt, if optlen is not valid, kernel should return
> -EINVAL. But a simple testcase as following, errno is 0, which means setsockopt
> is successful.
> addr.s_addr = inet_addr("192.1.2.3");
> setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF, &addr, 1);
> printf("errno is %d\n", errno);
>
> Xiaotian Feng(dfeng@xxxxxxxxxx) caught the bug. We fix it firstly checking
> the availability of optlen and then dealing with the logic like other options.
>
> Reported-by: Xiaotian Feng <dfeng@xxxxxxxxxx>
> Signed-off-by: Shan Wei <shanwei@xxxxxxxxxxxxxx>
> Acked-by: Alexey Kuznetsov <kuznet@xxxxxxxxxxxxx>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/