From nobody Fri Dec 19 18:41:42 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E9DFC67871 for ; Mon, 24 Oct 2022 20:25:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234145AbiJXUZa (ORCPT ); Mon, 24 Oct 2022 16:25:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234286AbiJXUXj (ORCPT ); Mon, 24 Oct 2022 16:23:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51884360B5; Mon, 24 Oct 2022 11:39:06 -0700 (PDT) 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 5C4D3B811B9; Mon, 24 Oct 2022 12:16:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B10E5C433D7; Mon, 24 Oct 2022 12:16:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613779; bh=qYKM/knQ12F6UlTUM7FZHtkKGNyWjWZQpvghfT6Vky4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cm1XkriFDjlcpcNxjIa8GR2lwZk9G1t30K2A+4OxHS0RBnVznJQfKQm/gQvZfI8fl hnkTc8Cqr5fGD3XNRJmlpSxK4fzAWkOXCLOg4uLMCCUbj/AHLE6hONqJLFxN7egWQR yiYTCV+xe+YRII8JC7gRH9BTPM3REOPXN7lb9JYg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Xiaoxu , "Paulo Alcantara (SUSE)" , Tom Talpey , Steve French Subject: [PATCH 5.10 011/390] cifs: Fix the error length of VALIDATE_NEGOTIATE_INFO message Date: Mon, 24 Oct 2022 13:26:48 +0200 Message-Id: <20221024113023.012197841@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhang Xiaoxu commit e98ecc6e94f4e6d21c06660b0f336df02836694f upstream. Commit d5c7076b772a ("smb3: add smb3.1.1 to default dialect list") extend the dialects from 3 to 4, but forget to decrease the extended length when specific the dialect, then the message length is larger than expected. This maybe leak some info through network because not initialize the message body. After apply this patch, the VALIDATE_NEGOTIATE_INFO message length is reduced from 28 bytes to 26 bytes. Fixes: d5c7076b772a ("smb3: add smb3.1.1 to default dialect list") Signed-off-by: Zhang Xiaoxu Cc: Acked-by: Paulo Alcantara (SUSE) Reviewed-by: Tom Talpey Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/smb2pdu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -1075,9 +1075,9 @@ int smb3_validate_negotiate(const unsign pneg_inbuf->Dialects[0] =3D cpu_to_le16(server->vals->protocol_id); pneg_inbuf->DialectCount =3D cpu_to_le16(1); - /* structure is big enough for 3 dialects, sending only 1 */ + /* structure is big enough for 4 dialects, sending only 1 */ inbuflen =3D sizeof(*pneg_inbuf) - - sizeof(pneg_inbuf->Dialects[0]) * 2; + sizeof(pneg_inbuf->Dialects[0]) * 3; } =20 rc =3D SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID,