From patchwork Tue Feb 25 13:27:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 3716781 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4914A9F2F7 for ; Tue, 25 Feb 2014 13:27:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5A21F200BE for ; Tue, 25 Feb 2014 13:27:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4AAF5201D3 for ; Tue, 25 Feb 2014 13:27:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752439AbaBYN10 (ORCPT ); Tue, 25 Feb 2014 08:27:26 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:49339 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752329AbaBYN10 (ORCPT ); Tue, 25 Feb 2014 08:27:26 -0500 Received: by mail-pa0-f41.google.com with SMTP id fa1so8081181pad.14 for ; Tue, 25 Feb 2014 05:27:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=I4guc46K5w45idU9LGsBcibRE60G/EkhmnDXX8d4lFc=; b=YI5Ag6zKBzcWzALN9+g56fwi/XbV8N9i0JCfbhVRCEv9/JYNUHzVBZ+WO3Wqaf54U/ qNNjrH1Io0LpiVTF5+ZuiDEee4Vt8QbMP7iD7rkxh4RZq9clRgum/wVTwV5l/SfIwud7 HqGJlJ3jSGtTO4bhBuvX5mD4FrHw4RZJvaWzowzMvYH536b8nZu9typSL4G+KQEV34la 19S6ikv1BjtJ49PUS3Gf9xMsqwkJNrLVBauag3yqhztcTSnP5UrxuauSWX0c68R2Lt70 hdx5HGMQ0P2wgG6+Qvs3tEl2+infCJkpOH5X7KSvN1pT9hxtt6iE5QGFh5dtUTKe7FlA /grg== X-Gm-Message-State: ALoCoQlVCE5L6UI8IEC9kyuJlrAWBVyYN/eaeZJVp0fm2f2fDE/042yEkI6q9uGoP1vHrftB4/7C X-Received: by 10.69.31.65 with SMTP id kk1mr6563795pbd.47.1393334845726; Tue, 25 Feb 2014 05:27:25 -0800 (PST) Received: from corrin.poochiereds.net.cthon.org (64-71-23-226.static.wiline.com. [64.71.23.226]) by mx.google.com with ESMTPSA id eb5sm143431078pad.22.2014.02.25.05.27.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Feb 2014 05:27:25 -0800 (PST) From: Jeff Layton To: smfrench@gmail.com Cc: klaus@kolle.com, sprabhu@redhat.com, linux-cifs@vger.kernel.org Subject: [PATCH] cifs: mask off top byte in get_rfc1002_length() Date: Tue, 25 Feb 2014 05:27:17 -0800 Message-Id: <1393334837-6480-1-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.8.5.3 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The 32-bit rfc1002 header field consists of a type byte and then a 24-bit length field, but get_rfc1002_length doesn't mask off the top byte. In most cases, it's not a problem since the RFC1002_SESSION_MESSAGE type is '\0', but when doing a RFC1002 session establishment, the type is non-zero and that throws off the returned length in smb_send_rqst. Reported-by: klaus@kolle.com Tested-by: Sachin Prabhu Signed-off-by: Jeff Layton --- fs/cifs/cifsglob.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index e7fe49e..45376a4 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -506,7 +506,7 @@ struct cifs_mnt_data { static inline unsigned int get_rfc1002_length(void *buf) { - return be32_to_cpu(*((__be32 *)buf)); + return be32_to_cpu(*((__be32 *)buf)) & 0xffffff; } static inline void