]> git.baikalelectronics.ru Git - kernel.git/commitdiff
fs: dlm: use packet in dlm_mhandle
authorAlexander Aring <aahringo@redhat.com>
Thu, 27 Oct 2022 20:45:14 +0000 (16:45 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 07:50:18 +0000 (08:50 +0100)
[ Upstream commit 20e8ad8a46be565e7fff262b0ca1988faccdda3d ]

To allow more than just dereferencing the inner header we directly point
to the inner dlm packet which allows us to dereference the header, rcom
or message structure.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
Stable-dep-of: caf2799e0b84 ("fs: dlm: fix use after free in midcomms commit")
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/dlm/midcomms.c

index 095f2005fb62144c224f3ba200dcd1cf0aafe322..4a8721ab9f149c0c2f43454487621d56ceeb8c64 100644 (file)
@@ -194,7 +194,7 @@ struct midcomms_node {
 };
 
 struct dlm_mhandle {
-       const struct dlm_header *inner_hd;
+       const union dlm_packet *inner_p;
        struct midcomms_node *node;
        struct dlm_opts *opts;
        struct dlm_msg *msg;
@@ -1049,7 +1049,7 @@ static struct dlm_msg *dlm_midcomms_get_msg_3_2(struct dlm_mhandle *mh, int node
        dlm_fill_opts_header(opts, len, mh->seq);
 
        *ppc += sizeof(*opts);
-       mh->inner_hd = (const struct dlm_header *)*ppc;
+       mh->inner_p = (const union dlm_packet *)*ppc;
        return msg;
 }
 
@@ -1127,7 +1127,7 @@ err:
 static void dlm_midcomms_commit_msg_3_2(struct dlm_mhandle *mh)
 {
        /* nexthdr chain for fast lookup */
-       mh->opts->o_nextcmd = mh->inner_hd->h_cmd;
+       mh->opts->o_nextcmd = mh->inner_p->header.h_cmd;
        mh->committed = true;
        dlm_lowcomms_commit_msg(mh->msg);
 }