cifs: use tcon allocation functions even for dummy tcon
authorShyam Prasad N <sprasad@microsoft.com>
Fri, 10 Feb 2023 16:34:31 +0000 (16:34 +0000)
committerSteve French <stfrench@microsoft.com>
Thu, 1 Jun 2023 04:11:39 +0000 (23:11 -0500)
In smb2_reconnect_server, we allocate a dummy tcon for
calling reconnect for just the session. This should be
allocated using tconInfoAlloc, and not kmalloc.

Fixes: 3663c9045f51 ("cifs: check reconnects for channels of active tcons too")
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smb2pdu.c

index 4982f5e65e13b97b7662543e0136ba907d6b2c47..09a0141d94f71b417abf2049b70e3834d688e89b 100644 (file)
@@ -3906,7 +3906,7 @@ void smb2_reconnect_server(struct work_struct *work)
                goto done;
 
        /* allocate a dummy tcon struct used for reconnect */
-       tcon = kzalloc(sizeof(struct cifs_tcon), GFP_KERNEL);
+       tcon = tconInfoAlloc();
        if (!tcon) {
                resched = true;
                list_for_each_entry_safe(ses, ses2, &tmp_ses_list, rlist) {
@@ -3929,7 +3929,7 @@ void smb2_reconnect_server(struct work_struct *work)
                list_del_init(&ses->rlist);
                cifs_put_smb_ses(ses);
        }
-       kfree(tcon);
+       tconInfoFree(tcon);
 
 done:
        cifs_dbg(FYI, "Reconnecting tcons and channels finished\n");