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 90D1E30DEB2; Mon, 13 Oct 2025 14:56:40 +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=1760367400; cv=none; b=dU0UUi2Hwj8CuXj5UMgCfCzYcIQ2MZzPjt31U3uFw6FITFVLQvJENPPH67b4lHpx7s9jTsVJ9zg2QXXfQ/F0AGklzgGjwKuydneGM9w55qTndTa8srnpAdGchGDZrI/GD4bY0BshFozmeiDbIbuf4vqGZm25NRrP5/GoXFT+4M0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760367400; c=relaxed/simple; bh=uorLUQrmCpj3zaBZnO1GHjmeeJiGQNVScMOTjhRsnHg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AhnDMmhGFKbAdrqn88+xhdMNlv8cxDV36Dmu1g/L6u0EJAxn63sKSci6nmuqaY8xR63CEcDeSsrvp8MqeVH4EZRnNSFU4kcuu55j7lH4YGZDn1ukPytcMLhyiL/fbu8edTC7MH4W0huziRm5hlEAPSfD79PQ5Qt1Fn5MEqYXVKY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=uY3wA6C7; 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="uY3wA6C7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D44AAC4CEE7; Mon, 13 Oct 2025 14:56:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760367400; bh=uorLUQrmCpj3zaBZnO1GHjmeeJiGQNVScMOTjhRsnHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uY3wA6C75indbq/El5Q5AfzT3O0I4149M8ZtUa0ut4xRJX/IIeG1NRMQmaf678ztJ kJ6m24E6RBlPeGPwMDUW9bw/PzC+MgKGAtUsCZ/QEMsqyu0M5r0kj2sXbXO9vI50le s32P2+sdYnkRkjdsFCL7qIdsUrFnkZHfn1o+3qsU= 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.1 162/196] ocfs2: fix double free in user_cluster_connect() Date: Mon, 13 Oct 2025 16:45:35 +0200 Message-ID: <20251013144320.559609547@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251013144314.549284796@linuxfoundation.org> References: <20251013144314.549284796@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.1-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 64e6ddcfe329a..e28905e58bd6a 100644 --- a/fs/ocfs2/stack_user.c +++ b/fs/ocfs2/stack_user.c @@ -1024,6 +1024,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