From patchwork Wed Aug 15 11:24:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 1325371 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 3CE6C40212 for ; Wed, 15 Aug 2012 11:25:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754076Ab2HOLZX (ORCPT ); Wed, 15 Aug 2012 07:25:23 -0400 Received: from mail-lpp01m010-f46.google.com ([209.85.215.46]:40405 "EHLO mail-lpp01m010-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754060Ab2HOLZQ (ORCPT ); Wed, 15 Aug 2012 07:25:16 -0400 Received: by lagy9 with SMTP id y9so765271lag.19 for ; Wed, 15 Aug 2012 04:25:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:x-mailer; bh=yATpHUom/Ve1ffCmw2sjr2ZWrSvI6EqCCpF/CK/mDrg=; b=UMaEyMPzfDaB5JlvGr4x8uiu/xG30BTvMnDSQLUOfDzwgCWa9J9RDV3X800++IQauX D7T6Lp8w7joHoeENWDKRWkUTxQlzAbbfY9SXAP3zQ3AyM0OPnedv+y/J+6f2IB2eZzGJ q18tc5KlvvR9wPPigG4hn70gJIvs4v6fTSFxXwePeBWGVq4gR3ltQ7iucdFVTKPpcLgF gb3eKLa0oHD5ovD+lYBOTF9q2kaRnWxiz52SU1vQiWCc7t76e3lx9UTLaCN6cJjFvGhT ar338gsHF3wxMBhTvEvyJDU/WnVIqixqZtYX7fjABemBgL6tZ+4PyjP3qxGFkdrgy0uO 4NcA== Received: by 10.152.111.71 with SMTP id ig7mr18906833lab.28.1345029914380; Wed, 15 Aug 2012 04:25:14 -0700 (PDT) Received: from localhost.localdomain ([95.84.9.233]) by mx.google.com with ESMTPS id gd9sm324527lbb.15.2012.08.15.04.25.12 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 15 Aug 2012 04:25:13 -0700 (PDT) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH 1/2] CIFS: Fix memory leak in SMB2 oplock break code Date: Wed, 15 Aug 2012 15:24:22 +0400 Message-Id: <1345029863-6731-1-git-send-email-pshilovsky@samba.org> X-Mailer: git-send-email 1.7.1 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org SendReceive2 doesn't free a response buffer but SendReceiveNoRsp does. Signed-off-by: Pavel Shilovsky --- fs/cifs/smb2pdu.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index b183420..88ac69c 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -1943,9 +1943,8 @@ SMB2_oplock_break(const unsigned int xid, struct cifs_tcon *tcon, const u64 persistent_fid, const u64 volatile_fid, __u8 oplock_level) { - int rc = 0, buf_type; + int rc; struct smb2_oplock_break *req = NULL; - struct kvec iov[1]; cFYI(1, "SMB2_oplock_break"); rc = small_smb2_init(SMB2_OPLOCK_BREAK, tcon, (void **) &req); @@ -1958,11 +1957,7 @@ SMB2_oplock_break(const unsigned int xid, struct cifs_tcon *tcon, req->OplockLevel = oplock_level; req->hdr.CreditRequest = cpu_to_le16(1); - iov->iov_base = (char *)req; - /* 4 for rfc1002 length */ - iov->iov_len = get_rfc1002_length(req) + 4; - - rc = SendReceive2(xid, tcon->ses, iov, 1, &buf_type, CIFS_OBREAK_OP); + rc = SendReceiveNoRsp(xid, tcon->ses, (char *) req, CIFS_OBREAK_OP); /* SMB2 buffer freed by function above */ if (rc) {