Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2319415pxb; Mon, 20 Sep 2021 18:42:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwCPkwB7qOl+yp2YUSdra0/dJIVGcIRzD+PlIe93gBSXLjsn1f9D/uEgUWXHIvlWvUitur X-Received: by 2002:a92:1952:: with SMTP id e18mr18803436ilm.291.1632188549983; Mon, 20 Sep 2021 18:42:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188549; cv=none; d=google.com; s=arc-20160816; b=ytay26g6AMyc0+K+H5rhxTqrVAba7UpBq1BHMYVLGjx+AhZwG/NEv15g+1us5ZFoRX xOftqUMdXphFO2CiD0VvGnz0GyS7CTLHy6qwJan0MKzMGhXr0w7eEwMfAvg4l4MqFwR7 7kjvTJLIow4FlmdFbL2rdX3QBg9PyLPXERgFCAGgUecK2NxdGqsir3evTI5ctiCSiLy8 HBhNZt5iICW6+MvLq2x/gP6Cjf4NM0u8+nMPn3q2fY8hOR2oiFCN2M6kxBOPAcIgUIlp lArledCFVeGncjsSMYoxwZrmYmP5xDPoa0etz7BIdC/B0d17C7sDePDjyVelogoJi18R zVmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=X3KqrXkU3+DMIV6ezqngQzXo8STnxzLzMNm3neE6t90=; b=i88vkUiFGatB4Yh6DoUfvKy5raba7om1ms3/bTgIm9Qew6RzveDIkpSj/77jr6U8JI HGDIFwESiOBdZxRqAgNX/oUwC2GDKrsZZkt8lB3cTOtAo2F5IOq940ypE5dfbmWQ2xBs ftTKhDtq5IGBkkmb6K9BbLZ6FJKzORIwX1Czyw5ulNADYzIKYO99l47RJqrXJxPC2dNk 6yHFZkVk958GlngSokHQY/tb2LAQ8pc+CBYv/AeiUFEuQUP4/hYZg8qKQ5SV5wSSIBF9 4HFLECeQCK7HGOaHf6UqbFONtXLm8v3OgOqoqmgUPg2LooOXjEk+EWULhWFrsgpzSKPB HtNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=np465ygQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u3si16970100iom.82.2021.09.20.18.42.18; Mon, 20 Sep 2021 18:42:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=np465ygQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245712AbhITQyl (ORCPT + 99 others); Mon, 20 Sep 2021 12:54:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:38940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235055AbhITQus (ORCPT ); Mon, 20 Sep 2021 12:50:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C1EB661356; Mon, 20 Sep 2021 16:49:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632156552; bh=wvImG6Kd4LlMY5c/CMhznAAaoKkkYegLJ08YLuKwVOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=np465ygQb6+Rx/j397rOUmoyjSK+mXgxjOEBQxC5LIiCgJFIt01wEpxolQm88WJaI JPWRXo0m/9FfGkFifdd/Z0ziW3WHoH8qH9+BYh7i6FDDCZHhJvG7Pg/2C0a2YnXQXq WyzRvNdzSUMMpPSfgectOygArvFkS//7mVP939RE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ding Hui , "Paulo Alcantara (SUSE)" , Steve French , Sasha Levin Subject: [PATCH 4.4 111/133] cifs: fix wrong release in sess_alloc_buffer() failed path Date: Mon, 20 Sep 2021 18:43:09 +0200 Message-Id: <20210920163916.252755185@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163912.603434365@linuxfoundation.org> References: <20210920163912.603434365@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ding Hui [ Upstream commit d72c74197b70bc3c95152f351a568007bffa3e11 ] smb_buf is allocated by small_smb_init_no_tc(), and buf type is CIFS_SMALL_BUFFER, so we should use cifs_small_buf_release() to release it in failed path. Signed-off-by: Ding Hui Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/cifs/sess.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 9bc7a29f88d6..2d3918cdcc28 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -602,7 +602,7 @@ sess_alloc_buffer(struct sess_data *sess_data, int wct) return 0; out_free_smb_buf: - kfree(smb_buf); + cifs_small_buf_release(smb_buf); sess_data->iov[0].iov_base = NULL; sess_data->iov[0].iov_len = 0; sess_data->buf0_type = CIFS_NO_BUFFER; -- 2.30.2