Re: [PATCH] cifs: fix srcip_matches() for ipv6

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Makes sense.

How did you discover this - did you have an ipv6 test case or by
inspection or ...?

On Wed, Jan 16, 2013 at 8:36 PM, Nickolai Zeldovich
<nickolai@xxxxxxxxxxxxx> wrote:
> srcip_matches() previously had code like this:
>
>   srcip_matches(..., struct sockaddr *rhs) {
>     /* ... */
>     struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *) &rhs;
>     return ipv6_addr_equal(..., &vaddr6->sin6_addr);
>   }
>
> which interpreted the values on the stack after the 'rhs' pointer as an
> ipv6 address.  The correct thing to do is to use 'rhs', not '&rhs'.
>
> Signed-off-by: Nickolai Zeldovich <nickolai@xxxxxxxxxxxxx>
> ---
>  fs/cifs/connect.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 17c3643..12b3da3 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -1917,7 +1917,7 @@ srcip_matches(struct sockaddr *srcaddr, struct sockaddr *rhs)
>         }
>         case AF_INET6: {
>                 struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *)srcaddr;
> -               struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *)&rhs;
> +               struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *)rhs;
>                 return ipv6_addr_equal(&saddr6->sin6_addr, &vaddr6->sin6_addr);
>         }
>         default:
> --
> 1.7.10.4
>



-- 
Thanks,

Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux