Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3691544pxb; Mon, 24 Jan 2022 15:30:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxd6RsIif2IoAYZ4vafQrNcOLNmjYLboz/wx7PRg2qchLXBJVzNX5hmgX3OCy8eX7Edh8e X-Received: by 2002:a63:89c8:: with SMTP id v191mr13518391pgd.228.1643066916304; Mon, 24 Jan 2022 15:28:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643066916; cv=none; d=google.com; s=arc-20160816; b=lxa6WStfw9HLMaXoin4O9nhpqQJbyf9oSKN979L89204v8wSys1p4gw8kqYaZnuJFq rV2xptywkLxu3OzF5D59K+Rw8iBVhdu43zVr6ps8CdXNRkE+WtnK8pgoqJvbbSe/XNF+ AQfGTci2zZpMU+P4m/PXHO/kEziIQNYJ/hpHWxZYCAHJ4fveZkgSEJSV1P1l9Ri2X0bT RWeTvj9ni6sJpvTzx+Qoll2kuPkBAyadRoTWM/9PULzVYBMmldEbzkfKpAqfRtTV1eBe 5iq2hmAeiMfzGAcFSJhuqnM3uvbQBwBYHy5nxlB1J/LatDb78By+HA/4NLIN00NCYLfO gMCQ== 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=qSOU+u2Mil3RIqxVYM8RGUgMN79NagucPwxCMbjT1hJIuP2W2aNRnC4xhv87wv69sS J52xgBF+wzj2SMcIx16+Aakru4iGaFNPI4pUVw+gnGAeWWiolQocWgKSjNiE5BJUkDl7 CcMZgwmi69TEQe65dwnn9RVZoi9pfUH0ZuV7+EtJzEMnEV+V28qPxWXbIYFaz+LfwKAd 602Cmd3kXg1WfEJTNffsU4TRVGVFDtysXt1YQMsrXUgPZysnTgBGt/nhgC/fq2++jBT2 XKWtIUrMzfvdY1cmR1CDl0tLreDIkWy2X3UUkCx1TGn75a5mBwkStYs2K3YRYG/3Q9XW flpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="z/1y1uJq"; 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 n11si13849502plk.442.2022.01.24.15.28.24; Mon, 24 Jan 2022 15:28:36 -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="z/1y1uJq"; 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 S1848465AbiAXXWd (ORCPT + 99 others); Mon, 24 Jan 2022 18:22:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1586851AbiAXW1Z (ORCPT ); Mon, 24 Jan 2022 17:27:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD07BC019B16; Mon, 24 Jan 2022 12:54:32 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 6D93D61287; Mon, 24 Jan 2022 20:54:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51FEFC36B01; Mon, 24 Jan 2022 20:54:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057671; bh=olKOp1fP6GqohxFV6u2yGgn8fWqUo03Gd4u6tv86pMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z/1y1uJq8aiwJCwCHHeFVdn0xlCEcLGGEoQl3OZCzluHP5zpN3sSl9ijaZXDbt73D j1/CMdy0rMPKk4Qu6VwSDJtlqHeNWJEA1x/V6PhiUPlBYrXv6OMDxoEoThSASt6ZYW erXCJnlu9hFhHADN3h3xIGEywRlNQ2I5jCWIwkSo= 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.16 0041/1039] ksmbd: add reserved room in ipc request/response Date: Mon, 24 Jan 2022 19:30:30 +0100 Message-Id: <20220124184126.518506728@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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 */ }; /*