Received: by 10.192.165.148 with SMTP id m20csp2430255imm; Sun, 22 Apr 2018 07:00:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx49BpXMoMdKQZ//DBNtzl8GE0LJRmZxhL6ETwL+PwZ7RhopB0fZG+kJnNU5GZPY1jcaTSDVX X-Received: by 10.99.115.28 with SMTP id o28mr14058923pgc.238.1524405631203; Sun, 22 Apr 2018 07:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524405631; cv=none; d=google.com; s=arc-20160816; b=TFtg1aAyYLGjoTocpo2hbCrWauctLgou6Am6fm+wMcteZumUzEQrtsKRp8F86hIxlA 3jfPucgZRb9eNEN9qSBUCutwcQ6NZW8YloHBBBrSwZoVppAjtZWqO0x2mxn3lPGIxXSS QgoslMs8OUdouBQglj2e2tBDu8gQOV+B7SZtYnRjdkXpo61E0Oi7pkEy2nUn0Hc9LIIY dwduR87U3UyU90f3UhYwDohIIPwMAFnriaodeqYmOOZsA1XB4hoEysTlv/EUaaZjTNUC +pxM4G2S7GqWc8JEDOhdtBHXH4/SsQU1SCnrK7d6/b42KruJdXMXelXSkXXOzybEgu9T dSDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=LLqXmouqxpvj8iM+L7Mt1wVHFlw+eTc5zTdkFhPdb74=; b=TZd4+jaNJ3dKd+bmBNe1x4Dq8xP5r5z5F77iY8Yxo1J1GF66oD/jsoBprGucmDtkNu ZdOKFAxgCkhngr+1Y43PIHOEUwBjF3hAI1g074n89q868opK6890lty3PdxBbSn1tA7R rNMoMiBD9u2SzoliauQgMpmpFN0269ob66C8e3qqrHMqfuu9GvufnPcfl5sKsOlUILli TdH43pI3Q2AdqeEXeG0+MSHOUKntkAihAO3rrCTSwK2oZf1QECn+HQLytR+WIhH8bBgb NCimCjpNcYWt69m0HrRosg2S8CVdnfRHqpdbbr4pby9Bl/UpuAFADxBamXu9JNS+jsE9 AKsw== 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 i4si3635310pgq.664.2018.04.22.07.00.17; Sun, 22 Apr 2018 07:00:31 -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 S1754002AbeDVN5i (ORCPT + 99 others); Sun, 22 Apr 2018 09:57:38 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45792 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753578AbeDVN5e (ORCPT ); Sun, 22 Apr 2018 09:57:34 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 556959CE; Sun, 22 Apr 2018 13:57:33 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ronnie Sahlberg , Steve French Subject: [PATCH 4.16 045/196] cifs: fix memory leak in SMB2_open() Date: Sun, 22 Apr 2018 15:51:05 +0200 Message-Id: <20180422135106.402766447@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135104.278511750@linuxfoundation.org> References: <20180422135104.278511750@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ronnie Sahlberg commit b7a73c84eb96dabd6bb8e9d7c56f796d83efee8e upstream. Signed-off-by: Ronnie Sahlberg Signed-off-by: Steve French CC: Stable Signed-off-by: Greg Kroah-Hartman --- fs/cifs/smb2pdu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -1738,8 +1738,10 @@ SMB2_open(const unsigned int xid, struct rc = alloc_path_with_tree_prefix(©_path, ©_size, &name_len, tcon->treeName, path); - if (rc) + if (rc) { + cifs_small_buf_release(req); return rc; + } req->NameLength = cpu_to_le16(name_len * 2); uni_path_len = copy_size; path = copy_path; @@ -1750,8 +1752,10 @@ SMB2_open(const unsigned int xid, struct if (uni_path_len % 8 != 0) { copy_size = roundup(uni_path_len, 8); copy_path = kzalloc(copy_size, GFP_KERNEL); - if (!copy_path) + if (!copy_path) { + cifs_small_buf_release(req); return -ENOMEM; + } memcpy((char *)copy_path, (const char *)path, uni_path_len); uni_path_len = copy_size;