cifs: fix handle leak in smb2_query_symlink()
authorRonnie Sahlberg <lsahlber@redhat.com>
Tue, 9 Apr 2019 21:47:22 +0000 (07:47 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 27 Apr 2019 07:36:33 +0000 (09:36 +0200)
commit2fcee5eaae6ee1c2ccbe629ffd46c6674a98824c
tree6692dce154e78369d77f8f23b2cb9580de3fd425
parentc69330a855ab4342d304f67f8c1e7d1fa2686bec
cifs: fix handle leak in smb2_query_symlink()

commit e6d0fb7b34f264f72c33053558a360a6a734905e upstream.

If we enter smb2_query_symlink() for something that is not a symlink
and where the SMB2_open() would succeed we would never end up
closing this handle and would thus leak a handle on the server.

Fix this by immediately calling SMB2_close() on successfull open.

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
CC: Stable <stable@vger.kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/smb2ops.c