cifs: return correct error in ->calc_signature()
authorEnzo Matsumiya <ematsumiya@suse.de>
Fri, 16 Sep 2022 23:57:05 +0000 (20:57 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 10:35:26 +0000 (12:35 +0200)
commitf0cac6cc02a9b965bcee3e980bf8ed5056cdfce0
treebf4174171600172ed60d86c93c6b716d3b9b9dad
parent1f1ab76e251521bd2fa5244473efcf663792745d
cifs: return correct error in ->calc_signature()

[ Upstream commit 09a1f9a168ae1f69f701689429871793174417d2 ]

If an error happens while getting the key or session in the
->calc_signature implementations, 0 (success) is returned. Fix it by
returning a proper error code.

Since it seems to be highly unlikely to happen wrap the rc check in
unlikely() too.

Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Fixes: 32811d242ff6 ("cifs: Start using per session key for smb2/3 for signature generation")
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/smb2transport.c