[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1232654449.15489.57.camel@localhost>
Date: Thu, 22 Jan 2009 12:00:48 -0800
From: Joe Perches <joe@...ches.com>
To: Jeff Layton <jlayton@...hat.com>
Cc: smfrench@...il.com, linux-cifs-client@...ts.samba.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] cifs: make sure we allocate enough storage for socket
address
On Thu, 2009-01-22 at 10:48 -0500, Jeff Layton wrote:
> The sockaddr declared on the stack in cifs_get_tcp_session is too small
> for IPv6 addresses. Change it from "struct sockaddr" to "struct
> sockaddr_storage" to prevent stack corruption when IPv6 is used.
>
> Signed-off-by: Jeff Layton <jlayton@...hat.com>
> ---
> fs/cifs/connect.c | 16 ++++++++--------
> 1 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index a3537a9..2209be9 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -1374,11 +1374,11 @@ cifs_find_tcp_session(struct sockaddr *addr)
> if (server->tcpStatus == CifsNew)
> continue;
>
> - if (addr->sa_family == AF_INET &&
> + if (addr->ss_family == AF_INET &&
> (addr4->sin_addr.s_addr !=
> server->addr.sockAddr.sin_addr.s_addr))
> continue;
> - else if (addr->sa_family == AF_INET6 &&
> + else if (addr->ss_family == AF_INET6 &&
> memcmp(&server->addr.sockAddr6.sin6_addr,
> &addr6->sin6_addr, sizeof(addr6->sin6_addr)))
!ipv6_addr_equal
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists