cifs: SMB1 split: Don't return smb_hdr from cifs_{,small_}buf_get()

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>
This commit is contained in:
David Howells
2025-12-17 17:47:22 +00:00
committed by Steve French
parent efbe45cc03
commit fee3181757
2 changed files with 6 additions and 7 deletions

View 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,

View 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);