linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ksmbd-tools: add reserved room in ipc request/response
@ 2022-01-06  1:57 Namjae Jeon
  0 siblings, 0 replies; only message in thread
From: Namjae Jeon @ 2022-01-06  1:57 UTC (permalink / raw)
  To: linux-cifs; +Cc: Namjae Jeon

Whenever new parameter is added to smb configuration, It is possible
to break the execution of the IPC daemon by mismatch size of
request/response. This patch tries to reserve space in ipc request/response
in advance to prevent that.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
 include/linux/ksmbd_server.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/linux/ksmbd_server.h b/include/linux/ksmbd_server.h
index 647cfee..78ae6e7 100644
--- a/include/linux/ksmbd_server.h
+++ b/include/linux/ksmbd_server.h
@@ -47,6 +47,7 @@ struct ksmbd_startup_request {
 	__u32	share_fake_fscaps;
 	__u32	sub_auth[3];
 	__u32	smb2_max_credits;
+	__u32   reserved[128];		/* Reserved room */
 	__u32	ifc_list_sz;
 	__s8	____payload[];
 };
@@ -54,12 +55,13 @@ struct ksmbd_startup_request {
 #define KSMBD_STARTUP_CONFIG_INTERFACES(s)	((s)->____payload)
 
 struct ksmbd_shutdown_request {
-	__s32	reserved;
+	__s32	reserved[16];
 };
 
 struct ksmbd_login_request {
 	__u32	handle;
 	__s8	account[KSMBD_REQ_MAX_ACCOUNT_NAME_SZ];
+	__u32   reserved[16];		/* Reserved room */
 };
 
 struct ksmbd_login_response {
@@ -70,11 +72,13 @@ struct ksmbd_login_response {
 	__u16	status;
 	__u16	hash_sz;
 	__s8	hash[KSMBD_REQ_MAX_HASH_SZ];
+	__u32   reserved[16];		/* Reserved room */
 };
 
 struct ksmbd_share_config_request {
 	__u32	handle;
 	__s8	share_name[KSMBD_REQ_MAX_SHARE_NAME];
+	__u32   reserved[16];		/* Reserved room */
 };
 
 struct ksmbd_share_config_response {
@@ -86,6 +90,7 @@ struct ksmbd_share_config_response {
 	__u16	force_directory_mode;
 	__u16	force_uid;
 	__u16	force_gid;
+	__u32   reserved[128];		/* Reserved room */
 	__u32	veto_list_sz;
 	__s8	____payload[];
 };
@@ -108,22 +113,26 @@ struct ksmbd_tree_connect_request {
 	__s8	account[KSMBD_REQ_MAX_ACCOUNT_NAME_SZ];
 	__s8	share[KSMBD_REQ_MAX_SHARE_NAME];
 	__s8	peer_addr[64];
+	__u32   reserved[16];		/* Reserved room */
 };
 
 struct ksmbd_tree_connect_response {
 	__u32	handle;
 	__u16	status;
 	__u16	connection_flags;
+	__u32   reserved[16];		/* Reserved room */
 };
 
 struct ksmbd_tree_disconnect_request {
 	__u64	session_id;
 	__u64	connect_id;
+	__u32   reserved[16];		/* Reserved room */
 };
 
 struct ksmbd_logout_request {
 	__s8	account[KSMBD_REQ_MAX_ACCOUNT_NAME_SZ];
 	__u32	account_flags;
+	__u32   reserved[16];		/* Reserved room */
 };
 
 struct ksmbd_rpc_command {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-06  1:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-06  1:57 [PATCH] ksmbd-tools: add reserved room in ipc request/response Namjae Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).