Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp459434pxb; Thu, 9 Sep 2021 05:05:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyO3Obw4GgxGlmkGnJtGcWKmY1r6kesgQ4vvoQB+EW0sacfT+9Cm+ZsjC/ujr/Nho2cejxu X-Received: by 2002:a05:6402:64e:: with SMTP id u14mr1877023edx.184.1631189123343; Thu, 09 Sep 2021 05:05:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631189123; cv=none; d=google.com; s=arc-20160816; b=UuB85FAuxwFvEndF7G8C8kKPf7aeH93yoKnqn7l2vMujyCACj/USUk0ERH7zVLZ6P+ jPBTc+0tDXQPJIartjhqR1pNnEb23/gV0pTdL69aa+yQUdVspo2Q/1gKDC0V80wy30T6 upJsXdD7Jswk9rCt0ESfbXN3M7jddjzgxOUdr/6/8RX6UYLqwAHD7ounyGT0j8vJIEIG Jkp8AS5cEWVCrkY7c7dZ9p58nmhd2Js7JZPm6yzoqhtdoKeK/O/nRN4RzZ62J940IyN1 LWcMl35HFMn53gJ/mCQ0nyHoCkhX7uI83kndRcOM2lOZ65iDfO0TirVUtgOqXSIIRP81 koNw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aKChAF6vEFupfXU1IwdKywqOyzP3/uBG5Nr9qokNFaY=; b=OUFxO0kRSuxnIO7Dsf5QQdQn2N/eYfJVjs87Trcb4KWkhSogHDlW7h7SZMLC7R7miT EqpXacXQmt8PRGnBS1ClnKuQIp95eMNJnujPzQy2L/afxAqs83jNZTYpTPAD0xb2SG9e Ovf7KPWzNes1xR99zFUyLcQApnRYQAaRXvhSXWstXhPy5HveXTKowaanknLDXwfh+QrD itaANeYpoQ96Um49xQTiymOv9NE6yrHKR7j0ddGFlpIygCr7Px2brsAB7geCGXlwxvkL 1TbH0bV1YFupQbTvklBA4GVMBXn83R7a0UGPXHY9leoqd2Wd2pDCxXB+TLZFBDH2biJJ neuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qA5w2UJa; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e29si1567188ejl.212.2021.09.09.05.04.45; Thu, 09 Sep 2021 05:05:23 -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=@kernel.org header.s=k20201202 header.b=qA5w2UJa; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344434AbhIIMCx (ORCPT + 99 others); Thu, 9 Sep 2021 08:02:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:34496 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243466AbhIIL6m (ORCPT ); Thu, 9 Sep 2021 07:58:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2F31E613DB; Thu, 9 Sep 2021 11:45:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187945; bh=iI3Nf3pgp84K2U+TapAd91phHv3h5a6aFXdCgxuUWqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qA5w2UJab4gw4Oqq50eMmiDM1ZURrvzXlj8aqZEZN8RegWlSU/ZRpHJLoXlYcfJtG dOvAMUbWZBeyLaIfkz30M7mVtuLmOSBFyB6XLp6xuOmIXQYBtvCeBaBFjUZpcs911e 0uR9TZU9o2ZEH/x9eOSwQf//xzW+/d/Jx4MzbHclOGxU1sse/i4/upRndvp9GV0QQ8 XDSf8BalTqQN+PZWJ94/yhyBof3iVzd3SFGDUrsjD+XlYVe369FhPxFVqjzoKddZMJ Kd5cjPhvx2OeQGWK8plNe04/bObOmsmGl+5iNi44Ko3twOtc9EL7NsrZl54dC+urvi hwFHyEDqvp4ng== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ding Hui , Paulo Alcantara , Steve French , Sasha Levin , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org Subject: [PATCH AUTOSEL 5.14 214/252] cifs: fix wrong release in sess_alloc_buffer() failed path Date: Thu, 9 Sep 2021 07:40:28 -0400 Message-Id: <20210909114106.141462-214-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 c5785fd3f52e..606fd7d6cb71 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -877,7 +877,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