Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp727292imm; Thu, 13 Sep 2018 06:55:00 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYi92Wuc0lMTjEJWx9U9Nx3JEhPizGheD+77y2BG6wNFQn8Wl3Ez5r8yk+u8y4Izjc7E2lI X-Received: by 2002:a17:902:b7c5:: with SMTP id v5-v6mr7567126plz.49.1536846899964; Thu, 13 Sep 2018 06:54:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536846899; cv=none; d=google.com; s=arc-20160816; b=q3xPZVAlum9905yiZyxHWw3zN8EKygRxkxqTHB9UisghRqlQvYP3mXq5HXvyuk4+35 1B+ijBELGG8amFP/jWFeAoJbdvXq87MUW2QAvPSwMs5FJ5iMc9ZzuE6eHomDRvDerVhL vJWzy+Cbe2ILvwGxp5FzEmltvd9SgDMnIpaNRQ2rXGNR4FODyVw42aj7s/f6MBQbXsGy 14fIZG1lpsaU2whYCpErd5HaN6SAUCaD73LJKvP9jpUSbybk0kY/jbwUZS3obEbttexV OVZKaNNmB1vELjFHffwFxID/vGh33TVzlEaqSHa8IZspFCjUMNUitKf7OtYFeX3/C08P U6sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=MQke1bxUGr6BkBYWzwAqnesC5uxN0QiF3lwiHFDKqhs=; b=ICyrrxuDSsO4Arw0jfC0YC+2VKG8aCKkI+XVyGSH0xCGFO9tRCoXqAvnXS1JiFmmsx 1ZMaapOgzwqVDg3H4NpCqltBaBzlCOtWHIuSPfyeMKTK87Bn6X1SXVzqjn0wfpLKdGIH IS6o2UdRhrpFzg1+hLLiwtkvhEicvvZ+dQNBwwAO5P+w5HHq2ldsVZvRteNLiW7HIfU+ Xz8+4PqUyEUxlP4IkdBKedinlcX0ppZMPXKcjxx19IcMILvwrXfICazk12fxpC3mjs10 5MUPgKrEv992vGNsm62iNt7HzLOTvwvL56ALwW/wzRac4qStXsu6vwVtu5AdXqOcqtYt ONXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 21-v6si4273650pgg.588.2018.09.13.06.54.44; Thu, 13 Sep 2018 06:54:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731193AbeIMTEP (ORCPT + 99 others); Thu, 13 Sep 2018 15:04:15 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33874 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728699AbeIMTEP (ORCPT ); Thu, 13 Sep 2018 15:04:15 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 565B1D1C; Thu, 13 Sep 2018 13:54:39 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ronnie Sahlberg , Steve French , Sasha Levin Subject: [PATCH 4.18 037/197] cifs: check if SMB2 PDU size has been padded and suppress the warning Date: Thu, 13 Sep 2018 15:29:46 +0200 Message-Id: <20180913131843.036039092@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ronnie Sahlberg [ Upstream commit e6c47dd0da1e3a484e778046fc10da0b20606a86 ] Some SMB2/3 servers, Win2016 but possibly others too, adds padding not only between PDUs in a compound but also to the final PDU. This padding extends the PDU to a multiple of 8 bytes. Check if the unexpected length looks like this might be the case and avoid triggering the log messages for : "SMB2 server sent bad RFC1001 len %d not %d\n" Signed-off-by: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/cifs/smb2misc.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/fs/cifs/smb2misc.c +++ b/fs/cifs/smb2misc.c @@ -241,6 +241,13 @@ smb2_check_message(char *buf, unsigned i return 0; /* + * Some windows servers (win2016) will pad also the final + * PDU in a compound to 8 bytes. + */ + if (((clc_len + 7) & ~7) == len) + return 0; + + /* * MacOS server pads after SMB2.1 write response with 3 bytes * of junk. Other servers match RFC1001 len to actual * SMB2/SMB3 frame length (header + smb2 response specific data)