linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jeff Layton <jlayton@redhat.com>
Cc: smfrench@gmail.com, linux-cifs-client@lists.samba.org,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] cifs: make sure we allocate enough storage for socket address
Date: Thu, 22 Jan 2009 12:00:48 -0800	[thread overview]
Message-ID: <1232654449.15489.57.camel@localhost> (raw)
In-Reply-To: <1232639298-9168-1-git-send-email-jlayton@redhat.com>

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@redhat.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



      reply	other threads:[~2009-01-22 20:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-22 15:48 [PATCH] cifs: make sure we allocate enough storage for socket address Jeff Layton
2009-01-22 20:00 ` Joe Perches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1232654449.15489.57.camel@localhost \
    --to=joe@perches.com \
    --cc=jlayton@redhat.com \
    --cc=linux-cifs-client@lists.samba.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=smfrench@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).