Subject: [CIFS] Copy struct *after* setting the port, instead of before.
From: Simo Leone <[email-masked]>
Date: Thu, 25 Jun 2009 02:44:43 +0000 (+0000)

[CIFS] Copy struct *after* setting the port, instead of before.

Acked-by: Jeff Layton <[email-masked]>
Signed-off-by: Simo Leone <[email-masked]>
Signed-off-by: Steve French <[email-masked]>
---

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index a581cfa..12c2cf6 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1496,14 +1496,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) {