From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA83630DEA0; Mon, 13 Oct 2025 15:41:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760370061; cv=none; b=uE8hr9xXD92FN72r2hrdB1Hgdc4fE02A4K87RIrd8VwfyvvbFalQHNHJZoUnNTNs8grTirqXdNM0iUSkSW346Rb8MiVcat8X3VWtCXjl5X/zWj7ysGUrIARQirURg2TfMYNZgNjTn4O8ur77LAAt/Xm+IbVfvsDmDPAMYz0qF7g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760370061; c=relaxed/simple; bh=Tk98j2ADW+HXb0Uz4nnfLZ0CBQi/A7Z4gMMgT/NRIx8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rxfX1c4bUtRPLVEDYDUN0KzBWOBhDTf1CiJ2HhMXCXxYsvzTkl5KEDjlH0gwSucBKqaPbxbMXrYt4NtTqgO/U8HXGXu/+I+AH1b1APsjZ1soLAWS4DzYmSzrtiRSI49LoEBfYUh8BAKi+GLkWWsHKUNBRvjO7wumGS8YUeQLJgE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=VbtBLBKd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="VbtBLBKd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF145C4CEE7; Mon, 13 Oct 2025 15:40:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760370060; bh=Tk98j2ADW+HXb0Uz4nnfLZ0CBQi/A7Z4gMMgT/NRIx8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VbtBLBKdhbDWi3u/HqIAF+XrhWSWVBuHy0XoT2V9C+S9TcmcckORoLXh7MGJ/Oy5+ dZqml6Z/rowvg0zudwOheKJF9/0g0EREqrD0T/1rZ0ZHKRej/XvJ1erZoGVS0L+prv zXm9eh3Z28tHCVwSsQrpAWz9D1cb9vmqKcLMPa2o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dan Carpenter , Joseph Qi , Goldwyn Rodrigues , Mark Fasheh , Joel Becker , Junxiao Bi , Changwei Ge , Jun Piao , Andrew Morton , Sasha Levin Subject: [PATCH 6.17 465/563] ocfs2: fix double free in user_cluster_connect() Date: Mon, 13 Oct 2025 16:45:26 +0200 Message-ID: <20251013144428.133479599@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251013144411.274874080@linuxfoundation.org> References: <20251013144411.274874080@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit 8f45f089337d924db24397f55697cda0e6960516 ] user_cluster_disconnect() frees "conn->cc_private" which is "lc" but then the error handling frees "lc" a second time. Set "lc" to NULL on this path to avoid a double free. Link: https://lkml.kernel.org/r/aNKDz_7JF7aycZ0k@stanley.mountain Fixes: c994c2ebdbbc ("ocfs2: use the new DLM operation callbacks while requesting new lockspace") Signed-off-by: Dan Carpenter Reviewed-by: Joseph Qi Reviewed-by: Goldwyn Rodrigues Cc: Mark Fasheh Cc: Joel Becker Cc: Junxiao Bi Cc: Changwei Ge Cc: Jun Piao Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin --- fs/ocfs2/stack_user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c index 0f045e45fa0c3..439742cec3c26 100644 --- a/fs/ocfs2/stack_user.c +++ b/fs/ocfs2/stack_user.c @@ -1011,6 +1011,7 @@ static int user_cluster_connect(struct ocfs2_cluster_connection *conn) printk(KERN_ERR "ocfs2: Could not determine" " locking version\n"); user_cluster_disconnect(conn); + lc = NULL; goto out; } wait_event(lc->oc_wait, (atomic_read(&lc->oc_this_node) > 0)); -- 2.51.0