cifs: make sure we allocate enough storage for socket address
authorJeff Layton <jlayton@redhat.com>
Thu, 22 Jan 2009 15:35:13 +0000 (10:35 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 6 Feb 2009 21:47:18 +0000 (13:47 -0800)
commit0c8d760228762ad7adf232ff39b3cdaad707d530
tree1d5108a5d0c865d0dcdc6f5f2c67c8ca706e9344
parent049ee5f967464ed93b6428eef7112c8ed1939acf
cifs: make sure we allocate enough storage for socket address

commit a9ac49d303f967be0dabd97cb722c4a13109c6c2 upstream.

cifs_mount declares a struct sockaddr on the stack and then casts it
to the proper address type. The storage allocated is fine for ipv4,
but is too small for ipv6 addresses. Declare it as
"struct sockaddr_storage" instead of struct sockaddr".

This bug was manifesting itself as oopses and address corruption when
mounting IPv6 addresses.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Tested-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/cifs/connect.c