Subject: Re: [BUG] icmpv6fuzz creates bad paging request

From: Eric Sesterhenn <[email-masked]>
Date: Fri, 2 Jan 2009 11:28:20 +0100

hi,

* Ilpo Järvinen ([email-masked]) wrote:
> On Thu, 1 Jan 2009, Eric Sesterhenn wrote:
> 
> > Hi,
> > 
> > running "icmpv6fuzz -r 2187" gives me the following oops with current -git
> 
> Can you try the patch below.
> 
> I wonder btw what's the correct policy wrt. those optval == NULL checks 
> that's visible in the patch' context (IPV6_PKTINFO is the only one which
> is doing that while many there fetch to sizeof(struct something)).

patch works for me, thanks for the fast reply.

Greetings, Eric

> [PATCH] ipv6: IPV6_PKTINFO relied userspace providing correct length
> 
> Signed-off-by: Ilpo Järvinen <[email-masked]>
> Reported-by: Eric Sesterhenn <[email-masked]>
> ---
>  net/ipv6/ipv6_sockglue.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
> index 0069b7e..d31df0f 100644
> --- a/net/ipv6/ipv6_sockglue.c
> +++ b/net/ipv6/ipv6_sockglue.c
> @@ -403,7 +403,7 @@ sticky_done:
>  		else if (optlen < sizeof(struct in6_pktinfo) || optval == NULL)
>  			goto e_inval;
>  
> -		if (copy_from_user(&pkt, optval, optlen)) {
> +		if (copy_from_user(&pkt, optval, sizeof(struct in6_pktinfo))) {
>  				retv = -EFAULT;
>  				break;
>  		}