From patchwork Thu Jan 27 16:41:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 512911 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 p0RGgBnn010879 for ; Thu, 27 Jan 2011 16:42:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752104Ab1A0Ql6 (ORCPT ); Thu, 27 Jan 2011 11:41:58 -0500 Received: from mail-yw0-f46.google.com ([209.85.213.46]:62666 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752048Ab1A0Ql6 (ORCPT ); Thu, 27 Jan 2011 11:41:58 -0500 Received: by ywe10 with SMTP id 10so670076ywe.19 for ; Thu, 27 Jan 2011 08:41:57 -0800 (PST) Received: by 10.100.195.5 with SMTP id s5mr730766anf.224.1296146517660; Thu, 27 Jan 2011 08:41:57 -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 d15sm20631839ana.35.2011.01.27.08.41.55 (version=SSLv3 cipher=RC4-MD5); Thu, 27 Jan 2011 08:41:56 -0800 (PST) From: Jeff Layton To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org Subject: [PATCH 1/2] cifs: fix length vs. total_read confusion in cifs_demultiplex_thread (try #2) Date: Thu, 27 Jan 2011 11:41:50 -0500 Message-Id: <1296146511-25942-1-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.3.4 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.6 (demeter1.kernel.org [140.211.167.41]); Thu, 27 Jan 2011 16:42:12 +0000 (UTC) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 47034af..41a0ba0 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -581,12 +581,12 @@ incomplete_rcv: else if (reconnect == 1) continue; - length += 4; /* account for rfc1002 hdr */ + total_read += 4; /* account for rfc1002 hdr */ - - dump_smb(smb_buffer, length); - if (checkSMB(smb_buffer, smb_buffer->Mid, total_read+4)) { - cifs_dump_mem("Bad SMB: ", smb_buffer, 48); + dump_smb(smb_buffer, total_read); + if (checkSMB(smb_buffer, smb_buffer->Mid, total_read)) { + cifs_dump_mem("Bad SMB: ", smb_buffer, + total_read < 48 ? total_read : 48); continue; }