Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2370037pxb; Mon, 20 Sep 2021 20:25:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSUg7VgFK5BEaSj7ZFNqctTJ1/gx3jRF6l4VS9B8JuvhujkKU45aAnwTE8D9E2rgxgxxED X-Received: by 2002:a50:f60a:: with SMTP id c10mr31968322edn.250.1632194711954; Mon, 20 Sep 2021 20:25:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632194711; cv=none; d=google.com; s=arc-20160816; b=JVkwbwE6IT7BbLJGH/vqVjn333h8GNwNGD4LC6d/wsU4uGJCb37oh+zFzFepTU7BPb qQJ9m6AaTaYtIPwmfHEoKBA8HAffe8LDh5m1ZnidVBJA+Rq1HbABV73RlUQR1Goo/7Z2 aN7tH388KMHBYjV5iFg/lyXakeVZNU60fcmCiMaHZppe7fHZeXwHDAdj/Aq3thPtf1oQ u3eXMVFyZmodKaBGLYndfSJIZkGqnuzaDEpKOt2HElIng3jrhkAHwrvN7VGuh/pG9Mik oCci1Ru3U6Dv9/yk64yk2x2TZ5W0pX5gK3+WlrP/+ES0mbGT/xHzpLwwf+hZbAH7svKL LQsw== 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=+5Sjmf2P4ZktpEqwOzTIfb4OLk9EvBPvO/Pei/F/iPI=; b=QOexvsfgm6MSHnhGg0RhRYoLD7vAB3kl1EgKb1u54OtIWkeC+GSMFGtiGU1IxFr21z PhbBMeS2rcnr9QnTuFP0k5HfIVJfMYtAP2pFbM0JNeaz1PFswBzJyx3Z350YQ0pLYsb2 84/oq8KcGTwIQoL2tKTxCExS/fiEfdhckatvfB3uwhQTr8hZMiDnbC2myJsW7ZVy6wi9 +J3Kt6jPgvLy92Lb+PJ6wW/7OxpHvsJCIKRJPOCzSiw6Wc38iNlxeOmpKOGpBDDxmzmp By7fKomkc50vdX9TMQojYJOBFJRe+5Labqs643//aJNXWB8bbcYTuWT+sDrn/p2z1v8L OoUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=e4U2yGd1; 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 c10si8917edm.600.2021.09.20.20.24.46; Mon, 20 Sep 2021 20:25:11 -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=e4U2yGd1; 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 S1348027AbhITSXE (ORCPT + 99 others); Mon, 20 Sep 2021 14:23:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:39242 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376856AbhITSOu (ORCPT ); Mon, 20 Sep 2021 14:14:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7CCEC61A61; Mon, 20 Sep 2021 17:21:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158507; bh=FwCJDxS2o/rIPFeTfezYzRrapeG4sI24aIt9JPu/XhE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e4U2yGd1YkS4Skvt1nUYOEjvwqAUw5tixEGO5npIo23pBOfcEAT31PxqM1tfEF/o1 3EDu1mfIBhXwN0g07bxvDLM6YPo24V3KEP8eG237f6mJReCCONyMvUPHX1exOgJQjk qLrw5IcRL2zd3XnMTibEQCw5e6v3w+1Oqm6vOHxw= 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 5.4 156/260] cifs: fix wrong release in sess_alloc_buffer() failed path Date: Mon, 20 Sep 2021 18:42:54 +0200 Message-Id: <20210920163936.408813658@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163931.123590023@linuxfoundation.org> References: <20210920163931.123590023@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 85bd644f9773..30f841a880ac 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -610,7 +610,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