Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3637309pxb; Mon, 24 Jan 2022 14:06:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJxKb+TPvUbsvCOug5YuVOTieGsn/cDuj2OUCCEebo2ZGCQlWeuk4zqZbUBjaFCI2pKAl6fQ X-Received: by 2002:a17:90a:de84:: with SMTP id n4mr367783pjv.76.1643061998992; Mon, 24 Jan 2022 14:06:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643061998; cv=none; d=google.com; s=arc-20160816; b=0nXeWamDSL2AvsrAvQOG/SdHdS4baI/qTcZ0Raxdai5hCEJT4Lt+6MwPTEtPi8GFiV w5FjALT20GcS3l/VhBAaeGCjAABAZANW3FaV6by7o4TTIro4Bmh1mxWLoKKH1uG/Pwvn Prhg84eZtS2pxAPdBzOOkSYZY++nF8aTHJ0WwPyebMIiV2sRWTQjZzT3JQl9W5vORwnO O2q3GltY77Z7jRHEF5HlpO5KaQvQ6vlZwJYRDTs0xTFy8Ushz8mTXS6eE30OLvrUC4mu hcDcoDFlpUEx/GSHELxYhQHUGnosCAwIk176qbSfdazBhugAviwaZ+EOOYSVh2KFfJIF Oyhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bAHtTXwaId/NAlGwTgYdlFvPyM2rwC5IQ4dw4H5M9Tw=; b=ieCy3fU4PR4SPj4dmzO5tVphaVLzUgRv8cBjmrwH7nXz84hS4jhGk8zcKFYwP3k+Y+ i0TWFC40hH+teE+GmIZ5/WNiUiIXwASaycdKYJo+vK3HPr2rbec6nc68oAbb/MZDqhCG kOKdULcJsLK5nZknO5SY7HxQdHb5sstrKijcd+MPX7VV/lBTxoEQsvLBpLj8DQ+04oW4 imbM/1qk3550IAgeYgJ49p/dgGjEdf++APVSwEnwDL+PLZkh5iD7E3PMwCwh9QzF/qjt 2Z6QghmYTthGder2v25vQWF5ST1zqUlcXLvTrKotzCEzze2RavhUEE9l8WMREg0jAHdL aw6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q5sAYIY2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si2752257plp.572.2022.01.24.14.06.26; Mon, 24 Jan 2022 14:06:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q5sAYIY2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575793AbiAXVwb (ORCPT + 99 others); Mon, 24 Jan 2022 16:52:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450069AbiAXVTl (ORCPT ); Mon, 24 Jan 2022 16:19:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5478C06F8EF; Mon, 24 Jan 2022 12:13:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6CBEFB810BD; Mon, 24 Jan 2022 20:13:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7917FC340E5; Mon, 24 Jan 2022 20:13:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055227; bh=olKOp1fP6GqohxFV6u2yGgn8fWqUo03Gd4u6tv86pMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q5sAYIY26DEBSxvo4CH5Ld/nxcCrezuRdPjW4Cwg4uURhqTm+l3sqKg1q4Ns7vg4A V9ci+2UJHlb9iy4iuTSEFfaoZOAFWQ+yAcGUfNbi7gUKulhFvB03ax9bKVbw6RebcW Fo5zOAtuU5I3lvo2vPKEJWcD4LD2cpZrBanf30ko= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namjae Jeon , Steve French Subject: [PATCH 5.15 039/846] ksmbd: add reserved room in ipc request/response Date: Mon, 24 Jan 2022 19:32:36 +0100 Message-Id: <20220124184102.289979131@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Namjae Jeon commit 41dbda16a0902798e732abc6599de256b9dc3b27 upstream. 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 Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/ksmbd/ksmbd_netlink.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/fs/ksmbd/ksmbd_netlink.h +++ b/fs/ksmbd/ksmbd_netlink.h @@ -104,6 +104,7 @@ struct ksmbd_startup_request { */ __u32 sub_auth[3]; /* Subauth value for Security ID */ __u32 smb2_max_credits; /* MAX credits */ + __u32 reserved[128]; /* Reserved room */ __u32 ifc_list_sz; /* interfaces list size */ __s8 ____payload[]; }; @@ -114,7 +115,7 @@ struct ksmbd_startup_request { * IPC request to shutdown ksmbd server. */ struct ksmbd_shutdown_request { - __s32 reserved; + __s32 reserved[16]; }; /* @@ -123,6 +124,7 @@ struct ksmbd_shutdown_request { struct ksmbd_login_request { __u32 handle; __s8 account[KSMBD_REQ_MAX_ACCOUNT_NAME_SZ]; /* user account name */ + __u32 reserved[16]; /* Reserved room */ }; /* @@ -136,6 +138,7 @@ struct ksmbd_login_response { __u16 status; __u16 hash_sz; /* hash size */ __s8 hash[KSMBD_REQ_MAX_HASH_SZ]; /* password hash */ + __u32 reserved[16]; /* Reserved room */ }; /* @@ -144,6 +147,7 @@ struct ksmbd_login_response { struct ksmbd_share_config_request { __u32 handle; __s8 share_name[KSMBD_REQ_MAX_SHARE_NAME]; /* share name */ + __u32 reserved[16]; /* Reserved room */ }; /* @@ -158,6 +162,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[]; }; @@ -188,6 +193,7 @@ 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 */ }; /* @@ -197,6 +203,7 @@ struct ksmbd_tree_connect_response { __u32 handle; __u16 status; __u16 connection_flags; + __u32 reserved[16]; /* Reserved room */ }; /* @@ -205,6 +212,7 @@ struct ksmbd_tree_connect_response { struct ksmbd_tree_disconnect_request { __u64 session_id; /* session id */ __u64 connect_id; /* tree connection id */ + __u32 reserved[16]; /* Reserved room */ }; /* @@ -213,6 +221,7 @@ struct ksmbd_tree_disconnect_request { struct ksmbd_logout_request { __s8 account[KSMBD_REQ_MAX_ACCOUNT_NAME_SZ]; /* user account name */ __u32 account_flags; + __u32 reserved[16]; /* Reserved room */ }; /*