mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: hexlabsecurity@proton.me, Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, ocfs2-devel@lists.linux.dev,
	Kurt Hackel <kurt.hackel@oracle.com>,
	Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>
Subject: Re: [PATCH 1/2] ocfs2: bound namelen in dlm_migrate_request_handler
Date: Thu, 2 Jul 2026 19:03:02 +0800	[thread overview]
Message-ID: <4b25d8e7-7348-482c-81cf-df7c4d0bb365@linux.alibaba.com> (raw)
In-Reply-To: <20260629-b4-disp-94fb6521-v1-1-6953bcc0421f@proton.me>



On 6/29/26 1:01 PM, Bryam Vargas via B4 Relay wrote:
> From: Bryam Vargas <hexlabsecurity@proton.me>
> 
> A node receiving a DLM_MIGRATE_REQUEST message trusts the peer-supplied
> name length (migrate->namelen) without bounding it.  dlm_init_mle() then
> copies that many bytes into the fixed DLM_LOCKID_NAME_MAX-byte mname[]
> array of an o2dlm_mle slab object, so a malformed message from a cluster
> peer overflows the slab object by up to ~215 bytes: a heap out-of-bounds
> write of attacker-controlled data, reachable by any node in the domain.
> 
> Reject an oversized name, the way dlm_master_request_handler() and the
> other o2dlm receive handlers already do; the migration handler omits the
> check entirely.  Conforming messages are unaffected.
> 
> Fixes: 6714d8e86bf4 ("[PATCH] OCFS2: The Second Oracle Cluster Filesystem")
> Cc: stable@vger.kernel.org
> Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>

Looks fine.
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> ---
>  fs/ocfs2/dlm/dlmmaster.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
> index 93eff38fdadd..bd7623cc6e77 100644
> --- a/fs/ocfs2/dlm/dlmmaster.c
> +++ b/fs/ocfs2/dlm/dlmmaster.c
> @@ -3100,6 +3100,12 @@ int dlm_migrate_request_handler(struct o2net_msg *msg, u32 len, void *data,
>  
>  	name = migrate->name;
>  	namelen = migrate->namelen;
> +	if (namelen > DLM_LOCKID_NAME_MAX) {
> +		mlog(ML_ERROR, "%s: invalid name length %u in migrate request\n",
> +		     dlm->name, namelen);
> +		ret = -EINVAL;
> +		goto leave;
> +	}
>  	hash = dlm_lockid_hash(name, namelen);
>  
>  	/* preallocate.. if this fails, abort */
> 


  reply	other threads:[~2026-07-02 11:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29  5:01 [PATCH 0/2] ocfs2/dlm: bound peer-controlled lengths in the o2dlm receive path Bryam Vargas via B4 Relay
2026-06-29  5:01 ` [PATCH 1/2] ocfs2: bound namelen in dlm_migrate_request_handler Bryam Vargas via B4 Relay
2026-07-02 11:03   ` Joseph Qi [this message]
2026-06-29  5:01 ` [PATCH 2/2] ocfs2: validate lengths in dlm_mig_lockres_handler Bryam Vargas via B4 Relay
2026-07-02 11:05   ` Joseph Qi
2026-07-02  5:56 ` [PATCH 0/2] ocfs2/dlm: bound peer-controlled lengths in the o2dlm receive path Joseph Qi
2026-07-02  9:27   ` Bryam Vargas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4b25d8e7-7348-482c-81cf-df7c4d0bb365@linux.alibaba.com \
    --to=joseph.qi@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=hexlabsecurity@proton.me \
    --cc=jlbec@evilplan.org \
    --cc=kurt.hackel@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@fasheh.com \
    --cc=ocfs2-devel@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®