cifs: prevent possible memory corruption in cifs_demultiplex_thread

cifs_demultiplex_thread sets the addr.sockAddr.sin_port without any
regard for the socket family. While it may be that the error in question
here never occurs on an IPv6 socket, it's probably best to be safe and
set the port properly if it ever does.

Break the port setting code out of cifs_fill_sockaddr and into a new
function, and call that from cifs_demultiplex_thread.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:
Jeff Layton
2010-09-03 12:00:50 -04:00
committed by Steve French
parent 7332f2a621
commit 32670396e7
3 changed files with 21 additions and 15 deletions

View File

@@ -463,7 +463,8 @@ incomplete_rcv:
* is since we do not begin with RFC1001 session
* initialize frame)
*/
server->addr.sockAddr.sin_port = htons(CIFS_PORT);
cifs_set_port((struct sockaddr *)
&server->addr.sockAddr, CIFS_PORT);
cifs_reconnect(server);
csocket = server->ssocket;
wake_up(&server->response_q);