From patchwork Sat Oct 22 07:18:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7140 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087428wrr; Sat, 22 Oct 2022 00:36:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6cF+5cCJR0fdt6E7uESfcvkzeSklqJdVNIHY0U01iRZ7Fw74yiljnc580/hvneE4Ic6Q6E X-Received: by 2002:a17:906:cc4f:b0:78d:fdd5:9ea9 with SMTP id mm15-20020a170906cc4f00b0078dfdd59ea9mr18516048ejb.57.1666424185459; Sat, 22 Oct 2022 00:36:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424185; cv=none; d=google.com; s=arc-20160816; b=Cy1wbDQs1dAsGdyX+VKc3l9h/C7c1j4UQlsRilmQcYV9LaYxURW1tG6uNLWtth8FrD 1CvuQAX90I2yW7pL654i2+RqhZPaouI4CNQ/6dmL+9ej8+MOr18OW34FQ+HxOtFw80QO tkcvP4jEe43sDf3ZoqAWE9c7w3HwRO4ScM3RHmbT23w8DoXVekxLsu1NRNxXs/AE9+aj ua5xLDowDX4tCtWEm21/Z9KoxHX6gsW2FP3r1yZoGWsWcRTJ/70v685QxaiUd/qIybj4 2oU6KypRBEzaY41zwbEs3q6bPaEGl9OsrWEz06ArhTj74zlX28/T9E5ExvSt3DjGyVJN y5Kw== 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=1Z0cpAA2gPaxaDA7Hudpfi6w4Z1UIJnNWCC05RLFmNE=; b=ZI6WkZIWaeIY2YpBZw9QCBLV0xM9KrkW2XSLNi0wNnQfZAAPYDOkXVpNARD4Ltuvh+ Fq1hWJbGL26/oDv/CK2f9YYD2ctQNm/sxzG4quG96LStW/UN+a0hSM72QP9w5QxpxgVO Lbes8d527srMuSN8Tsy9n6yiXpK/xnIX6UBuHAb+Ez/f/1jhF1Qz4EdMsnwU82fiDUMg 0BuekN/sCU2Z6vuuLhuK34IevX8DMqGhRgRIcqowHwR1h9zqKgTuT0VgSl5fuI7gq5ga UGX06L1ntFmwS/jZHJTqiL79az+kjZEu8+YtgJPaYAe9wdDbEPG/CofLRaLHoPGNm/6d wH9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZqIF+TsJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd10-20020a170907628a00b0078dacbcaa7asi22416665ejc.992.2022.10.22.00.36.01; Sat, 22 Oct 2022 00:36:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZqIF+TsJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230273AbiJVHfR (ORCPT + 99 others); Sat, 22 Oct 2022 03:35:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230203AbiJVHem (ORCPT ); Sat, 22 Oct 2022 03:34:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 908A1357C5; Sat, 22 Oct 2022 00:34:29 -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 dfw.source.kernel.org (Postfix) with ESMTPS id B936E60AD9; Sat, 22 Oct 2022 07:34:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB2D1C433D7; Sat, 22 Oct 2022 07:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424068; bh=R9pusQAITq/r7Pnku+U28DKSfwlq7tVODE7WmxvlkmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZqIF+TsJbRFNV/ICgXAgtHDo0DS00AeOviUE/6LM+Cm89BEpCJN88fqTpCVdBBBFM AZAB0JU3h6eriy0M9ghxwZeyOp+lzpmc+bK78Ugtia0vxaeA7lTEdvWB8IPI2cD8i3 aC/DZlARRXJCTZjr0m/n/t0nnA/EINXtk2ZYFiv0= 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.19 018/717] cifs: Fix the error length of VALIDATE_NEGOTIATE_INFO message Date: Sat, 22 Oct 2022 09:18:17 +0200 Message-Id: <20221022072418.296354338@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747372406721768356?= X-GMAIL-MSGID: =?utf-8?q?1747372406721768356?= 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 @@ -1168,9 +1168,9 @@ int smb3_validate_negotiate(const unsign pneg_inbuf->Dialects[0] = cpu_to_le16(server->vals->protocol_id); pneg_inbuf->DialectCount = 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 = sizeof(*pneg_inbuf) - - sizeof(pneg_inbuf->Dialects[0]) * 2; + sizeof(pneg_inbuf->Dialects[0]) * 3; } rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID,