]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
cifs: fix potential double put of TCP session reference
authorJeff Layton <jlayton@redhat.com>
Tue, 14 Sep 2010 15:38:24 +0000 (11:38 -0400)
committerSteve French <sfrench@us.ibm.com>
Tue, 14 Sep 2010 23:21:03 +0000 (23:21 +0000)
commit460cf3411b858ad509d5255e0dfaf862a83c0299
tree3ff261b74c1751b9b0edd904f8d2d7f09f7440f6
parentbfa88ea7ee9e6b4fd673e45a8cc0a8e0b7ef4761
cifs: fix potential double put of TCP session reference

cifs_get_smb_ses must be called on a server pointer on which it holds an
active reference. It first does a search for an existing SMB session. If
it finds one, it'll put the server reference and then try to ensure that
the negprot is done, etc.

If it encounters an error at that point then it'll return an error.
There's a potential problem here though. When cifs_get_smb_ses returns
an error, the caller will also put the TCP server reference leading to a
double-put.

Fix this by having cifs_get_smb_ses only put the server reference if
it found an existing session that it could use and isn't returning an
error.

Cc: stable@kernel.org
Reviewed-by: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/connect.c