Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp518532pxb; Thu, 9 Sep 2021 06:18:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBPExxKAKPaXngfsQsQeaw6IMsKvjlqsPMuQVrcZAFW2c2XSoWHZmGyO/DFSG8rMCdx4bR X-Received: by 2002:a6b:b4d3:: with SMTP id d202mr2715827iof.8.1631193493591; Thu, 09 Sep 2021 06:18:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631193493; cv=none; d=google.com; s=arc-20160816; b=dvEXP3nRZ2MUmDsyaycoCKWNksyp6pyxc3iNYNUZkG9HXPV+Q6OOzecWrYXgcQ3+yw bcEg+Hy9AG1v9CwFXJdckcFTkY81dYV/IAKq/JgPINkPG7vIu1Wj0u+2EjrDF40mCltk xcTHqTyptrIbkXhmPjqyICGXzpe361qi0o4viRYoQfshZNsfKLCFFv3ASUbm3QammhhP NhE1IYdMmbXEWRaqR+6o6NvHR9WpIMWqDTr4RryNsVI4DVFcpe+nFt/wfDumCAezp6Xi u/SVFM+0rEcOe3b9LxRdl5XeeLxpg9YdezkpZ4tu3oz8yv7EPHAAD84t7sJqRfdc1QOA DEIQ== 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=Xef/RQgg70yFLB1/MDOcZG2+tDID+vVS5wn0SFt60Rs=; b=aAZOHw9LLcmV3EFI1qTaO/29kZdmPfHpHM/3bcOeo1HObGqsa5Bkm94KUaDC7sOMiM yMr3yhzO53mBHWwJ3XQIw+kV9KT+tysIvNxHpmEVYfA2MGbTJUn4baeHtNUI0PlIrFCV VsZXEIl5XPK5wiYKh7OAwyy4bRBkIvdd7Tm8/HzILZgTk9JCxWA4F1IjRbBV11QEYkHu UnhaBMNoOVWoDBB7WO//Dp2uY+fnKocIhXW3vFEZ1qBNH31ZS89PWVfU+eByslU2QLux w5YH5kS/w3QXcCp9q9nwSQ99uh59J8G1OPnoqYhd+ia+rArYMasbnC9r3xSuNR/NyFpm 05oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OHJTIs4K; 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 k12si1751415jac.101.2021.09.09.06.18.01; Thu, 09 Sep 2021 06:18:13 -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=OHJTIs4K; 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 S1359386AbhIINSE (ORCPT + 99 others); Thu, 9 Sep 2021 09:18:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:53470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357889AbhIINFS (ORCPT ); Thu, 9 Sep 2021 09:05:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 28B6761212; Thu, 9 Sep 2021 12:00:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631188801; bh=Hf2RRelyE2amnSnIibj8OQSt2FVQFWgfHCv0/xYHdsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OHJTIs4KZhqW82qcHmcdITIWiR8j9QCPxGRJxa5P1dqWVdbkdaHwkc9ZlMjJQthNx fnDMgmMi0CN3cabukU0VyVCahnJ8EJEcmkp1B+asxb5entoh7nFwX6qdrmqC0J7XuR XXXHaO1kqqsmZXuEmLlaWmFau7Fj45PMX3ZNsv/ytVI6v26Ly7uwv0Cqb1v50X4Mp6 TdYKsBum5wCFOit8RzhMqTVmZW7l8RdHeS5mK5YG8Io3149U8QtAchf36tzoiQJoXk HbuxOQiyxaVii40yiwvVkNHhfgU0noYtuRDUqPeJ2XcfcZxSrPEJtn2SZcv/TXKlcD tHoAwR6x4juWA== 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 4.14 48/59] cifs: fix wrong release in sess_alloc_buffer() failed path Date: Thu, 9 Sep 2021 07:58:49 -0400 Message-Id: <20210909115900.149795-48-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909115900.149795-1-sashal@kernel.org> References: <20210909115900.149795-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 aa23c00367ec..0113dba28eb0 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