]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cifs: SMB1 split: Don't return smb_hdr from cifs_{,small_}buf_get()
authorDavid Howells <dhowells@redhat.com>
Wed, 17 Dec 2025 17:47:22 +0000 (17:47 +0000)
committerSteve French <stfrench@microsoft.com>
Sun, 8 Feb 2026 23:07:45 +0000 (17:07 -0600)
Return void* rather than struct smb_hdr* from from cifs_buf_get() and
cifs_small_buf_get() as SMB2/3 shouldn't be accessing smb_hdr.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/cifsproto.h
fs/smb/client/misc.c

index 53d23958b9daf35b9474adb2cf4550e4d5926458..6cf084aeb30e1e73e01e6468bf1740b04340baba 100644 (file)
@@ -26,9 +26,9 @@ struct smb3_fs_context;
  *****************************************************************
  */
 
-struct smb_hdr *cifs_buf_get(void);
+void *cifs_buf_get(void);
 void cifs_buf_release(void *buf_to_free);
-struct smb_hdr *cifs_small_buf_get(void);
+void *cifs_small_buf_get(void);
 void cifs_small_buf_release(void *buf_to_free);
 void free_rsp_buf(int resp_buftype, void *rsp);
 int smb_send_kvec(struct TCP_Server_Info *server, struct msghdr *smb_msg,
index dab2d594f024ef6aecf5c4d5e835e278bba0cf6f..273c54d398576169683fa6cde8b7c9e6e1ce9842 100644 (file)
@@ -178,10 +178,10 @@ tconInfoFree(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace)
        kfree(tcon);
 }
 
-struct smb_hdr *
+void *
 cifs_buf_get(void)
 {
-       struct smb_hdr *ret_buf = NULL;
+       void *ret_buf = NULL;
        /*
         * SMB2 header is bigger than CIFS one - no problems to clean some
         * more bytes for CIFS.
@@ -220,10 +220,10 @@ cifs_buf_release(void *buf_to_free)
        return;
 }
 
-struct smb_hdr *
+void *
 cifs_small_buf_get(void)
 {
-       struct smb_hdr *ret_buf = NULL;
+       void *ret_buf = NULL;
 
 /* We could use negotiated size instead of max_msgsize -
    but it may be more efficient to always alloc same size
@@ -231,7 +231,6 @@ cifs_small_buf_get(void)
    defaults to this and can not be bigger */
        ret_buf = mempool_alloc(cifs_sm_req_poolp, GFP_NOFS);
        /* No need to clear memory here, cleared in header assemble */
-       /*      memset(ret_buf, 0, sizeof(struct smb_hdr) + 27);*/
        atomic_inc(&small_buf_alloc_count);
 #ifdef CONFIG_CIFS_STATS2
        atomic_inc(&total_small_buf_alloc_count);