From patchwork Wed Dec 22 13:39:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 427251 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBMDdEAU030327 for ; Wed, 22 Dec 2010 13:39:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752779Ab0LVNjN (ORCPT ); Wed, 22 Dec 2010 08:39:13 -0500 Received: from mail-gy0-f174.google.com ([209.85.160.174]:50175 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752536Ab0LVNjN (ORCPT ); Wed, 22 Dec 2010 08:39:13 -0500 Received: by gyb11 with SMTP id 11so2100035gyb.19 for ; Wed, 22 Dec 2010 05:39:12 -0800 (PST) Received: by 10.100.92.18 with SMTP id p18mr4093154anb.254.1293025152669; Wed, 22 Dec 2010 05:39:12 -0800 (PST) Received: from salusa.poochiereds.net (cpe-071-070-153-003.nc.res.rr.com [71.70.153.3]) by mx.google.com with ESMTPS id t23sm6465865ano.26.2010.12.22.05.39.11 (version=SSLv3 cipher=RC4-MD5); Wed, 22 Dec 2010 05:39:11 -0800 (PST) From: Jeff Layton To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org Subject: [PATCH] cifs: just ignore extra junk at the end of the SMB Date: Wed, 22 Dec 2010 08:39:07 -0500 Message-Id: <1293025147-11338-1-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.3.3 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 22 Dec 2010 13:39:15 +0000 (UTC) diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 43f1028..b3df037 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c @@ -465,26 +465,13 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length) if (((4 + len) & 0xFFFF) == (clc_len & 0xFFFF)) return 0; /* bcc wrapped */ } - cFYI(1, "Calculated size %d vs length %d mismatch for mid %d", + + /* + * We allow the server to send us an arbitrary amount of junk + * at the end of the SMB. Just ignore it. + */ + cFYI(1, "Calculated size %u vs length %u mismatch for mid %u", clc_len, 4 + len, smb->Mid); - /* Windows XP can return a few bytes too much, presumably - an illegal pad, at the end of byte range lock responses - so we allow for that three byte pad, as long as actual - received length is as long or longer than calculated length */ - /* We have now had to extend this more, since there is a - case in which it needs to be bigger still to handle a - malformed response to transact2 findfirst from WinXP when - access denied is returned and thus bcc and wct are zero - but server says length is 0x21 bytes too long as if the server - forget to reset the smb rfc1001 length when it reset the - wct and bcc to minimum size and drop the t2 parms and data */ - if ((4+len > clc_len) && (len <= clc_len + 512)) - return 0; - else { - cERROR(1, "RFC1001 size %d bigger than SMB for Mid=%d", - len, smb->Mid); - return 1; - } } return 0; }