cifs: fix potential null pointer use in destroy_workqueue in init_cifs error path
authorSteve French <stfrench@microsoft.com>
Sun, 21 Jul 2024 20:45:56 +0000 (15:45 -0500)
committerSteve French <stfrench@microsoft.com>
Tue, 23 Jul 2024 16:04:23 +0000 (11:04 -0500)
commit193cc89ea0ca1da311877d2b4bb5e9f03bcc82a2
tree3e7a4474f9aeb2ab72249d183da0a172454e748a
parent33c9de2960d347c06d016c2c07ac4aa855cd75f0
cifs: fix potential null pointer use in destroy_workqueue in init_cifs error path

Dan Carpenter reported a Smack static checker warning:
   fs/smb/client/cifsfs.c:1981 init_cifs()
   error: we previously assumed 'serverclose_wq' could be null (see line 1895)

The patch which introduced the serverclose workqueue used the wrong
oredering in error paths in init_cifs() for freeing it on errors.

Fixes: 173217bd7336 ("smb3: retrying on failed server close")
Cc: stable@vger.kernel.org
Cc: Ritvik Budhiraja <rbudhiraja@microsoft.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: David Howells <dhowell@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/cifsfs.c