Skip to content

Commit 41dbda1

Browse files
namjaejeonsmfrench
authored andcommitted
ksmbd: add reserved room in ipc request/response
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 <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 99b7650 commit 41dbda1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

fs/ksmbd/ksmbd_netlink.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ struct ksmbd_startup_request {
104104
*/
105105
__u32 sub_auth[3]; /* Subauth value for Security ID */
106106
__u32 smb2_max_credits; /* MAX credits */
107+
__u32 reserved[128]; /* Reserved room */
107108
__u32 ifc_list_sz; /* interfaces list size */
108109
__s8 ____payload[];
109110
};
@@ -114,7 +115,7 @@ struct ksmbd_startup_request {
114115
* IPC request to shutdown ksmbd server.
115116
*/
116117
struct ksmbd_shutdown_request {
117-
__s32 reserved;
118+
__s32 reserved[16];
118119
};
119120

120121
/*
@@ -123,6 +124,7 @@ struct ksmbd_shutdown_request {
123124
struct ksmbd_login_request {
124125
__u32 handle;
125126
__s8 account[KSMBD_REQ_MAX_ACCOUNT_NAME_SZ]; /* user account name */
127+
__u32 reserved[16]; /* Reserved room */
126128
};
127129

128130
/*
@@ -136,6 +138,7 @@ struct ksmbd_login_response {
136138
__u16 status;
137139
__u16 hash_sz; /* hash size */
138140
__s8 hash[KSMBD_REQ_MAX_HASH_SZ]; /* password hash */
141+
__u32 reserved[16]; /* Reserved room */
139142
};
140143

141144
/*
@@ -144,6 +147,7 @@ struct ksmbd_login_response {
144147
struct ksmbd_share_config_request {
145148
__u32 handle;
146149
__s8 share_name[KSMBD_REQ_MAX_SHARE_NAME]; /* share name */
150+
__u32 reserved[16]; /* Reserved room */
147151
};
148152

149153
/*
@@ -158,6 +162,7 @@ struct ksmbd_share_config_response {
158162
__u16 force_directory_mode;
159163
__u16 force_uid;
160164
__u16 force_gid;
165+
__u32 reserved[128]; /* Reserved room */
161166
__u32 veto_list_sz;
162167
__s8 ____payload[];
163168
};
@@ -188,6 +193,7 @@ struct ksmbd_tree_connect_request {
188193
__s8 account[KSMBD_REQ_MAX_ACCOUNT_NAME_SZ];
189194
__s8 share[KSMBD_REQ_MAX_SHARE_NAME];
190195
__s8 peer_addr[64];
196+
__u32 reserved[16]; /* Reserved room */
191197
};
192198

193199
/*
@@ -197,6 +203,7 @@ struct ksmbd_tree_connect_response {
197203
__u32 handle;
198204
__u16 status;
199205
__u16 connection_flags;
206+
__u32 reserved[16]; /* Reserved room */
200207
};
201208

202209
/*
@@ -205,6 +212,7 @@ struct ksmbd_tree_connect_response {
205212
struct ksmbd_tree_disconnect_request {
206213
__u64 session_id; /* session id */
207214
__u64 connect_id; /* tree connection id */
215+
__u32 reserved[16]; /* Reserved room */
208216
};
209217

210218
/*
@@ -213,6 +221,7 @@ struct ksmbd_tree_disconnect_request {
213221
struct ksmbd_logout_request {
214222
__s8 account[KSMBD_REQ_MAX_ACCOUNT_NAME_SZ]; /* user account name */
215223
__u32 account_flags;
224+
__u32 reserved[16]; /* Reserved room */
216225
};
217226

218227
/*

0 commit comments

Comments
 (0)