summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2025-09-23 14:26:07 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-10-15 11:58:06 +0200
commit7e76fe9dfadbc00364d7523d5a109e9d3e4a7db2 (patch)
tree19645e62b1b3cad4101fd588457c43953f369314
parentf4238064379a91e71a9c258996acac43c50c2094 (diff)
downloadlinux-7e76fe9dfadbc00364d7523d5a109e9d3e4a7db2.tar.gz
linux-7e76fe9dfadbc00364d7523d5a109e9d3e4a7db2.tar.bz2
linux-7e76fe9dfadbc00364d7523d5a109e9d3e4a7db2.zip
ocfs2: fix double free in user_cluster_connect()
[ 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 <dan.carpenter@linaro.org> Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com> Reviewed-by: Goldwyn Rodrigues <rgoldwyn@suse.de> Cc: Mark Fasheh <mark@fasheh.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Junxiao Bi <junxiao.bi@oracle.com> Cc: Changwei Ge <gechangwei@live.cn> Cc: Jun Piao <piaojun@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--fs/ocfs2/stack_user.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
index 9b76ee66aeb2..38c0d6f64fce 100644
--- a/fs/ocfs2/stack_user.c
+++ b/fs/ocfs2/stack_user.c
@@ -1018,6 +1018,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));