ipv6: Fix the return value of Set Hop-by-Hop options header with NULL data pointer

When Set Hop-by-Hop options header with NULL data
pointer and optlen is not zero use setsockopt(),
the kernel successfully return 0 instead of
return error EINVAL or EFAULT.

This patch fix the problem.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Yang Hongyang and committed by David S. Miller cfb266c0 1730554f

+2
+2
net/ipv6/ipv6_sockglue.c
··· 346 346 */ 347 347 if (optlen == 0) 348 348 optval = NULL; 349 + else if (optval == NULL) 350 + goto e_inval; 349 351 else if (optlen < sizeof(struct ipv6_opt_hdr) || 350 352 optlen & 0x7 || optlen > 8 * 255) 351 353 goto e_inval;