diff mbox

[linux-cifs-client] cifs: Fix port overriding

Message ID 1243845470-22619-1-git-send-email-simo@archlinux.org (mailing list archive)
State New, archived
Headers show

Commit Message

Simo Leone June 1, 2009, 8:37 a.m. UTC
Copy struct *after* setting the port, instead of before.

Signed-off-by: Simo Leone <simo@archlinux.org>
---
 fs/cifs/connect.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Jeff Layton June 1, 2009, 10:35 a.m. UTC | #1
On Mon,  1 Jun 2009 01:37:50 -0700
Simo Leone <simo@archlinux.org> wrote:

> Copy struct *after* setting the port, instead of before.
> 
> Signed-off-by: Simo Leone <simo@archlinux.org>
> ---
>  fs/cifs/connect.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 0344b26..6462071 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -1506,14 +1506,14 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
>  		cFYI(1, ("attempting ipv6 connect"));
>  		/* BB should we allow ipv6 on port 139? */
>  		/* other OS never observed in Wild doing 139 with v6 */
> +		sin_server6->sin6_port = htons(volume_info->port);
>  		memcpy(&tcp_ses->addr.sockAddr6, sin_server6,
>  			sizeof(struct sockaddr_in6));
> -		sin_server6->sin6_port = htons(volume_info->port);
>  		rc = ipv6_connect(tcp_ses);
>  	} else {
> +		sin_server->sin_port = htons(volume_info->port);
>  		memcpy(&tcp_ses->addr.sockAddr, sin_server,
>  			sizeof(struct sockaddr_in));
> -		sin_server->sin_port = htons(volume_info->port);
>  		rc = ipv4_connect(tcp_ses);
>  	}
>  	if (rc < 0) {
> -- 
> 1.6.3.1
> 

Acked-by: Jeff Layton <jlayton@redhat.com>
diff mbox

Patch

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 0344b26..6462071 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1506,14 +1506,14 @@  cifs_get_tcp_session(struct smb_vol *volume_info)
 		cFYI(1, ("attempting ipv6 connect"));
 		/* BB should we allow ipv6 on port 139? */
 		/* other OS never observed in Wild doing 139 with v6 */
+		sin_server6->sin6_port = htons(volume_info->port);
 		memcpy(&tcp_ses->addr.sockAddr6, sin_server6,
 			sizeof(struct sockaddr_in6));
-		sin_server6->sin6_port = htons(volume_info->port);
 		rc = ipv6_connect(tcp_ses);
 	} else {
+		sin_server->sin_port = htons(volume_info->port);
 		memcpy(&tcp_ses->addr.sockAddr, sin_server,
 			sizeof(struct sockaddr_in));
-		sin_server->sin_port = htons(volume_info->port);
 		rc = ipv4_connect(tcp_ses);
 	}
 	if (rc < 0) {