mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Junrui Luo <moonafterrain@outlook.com>, akpm <akpm@linux-foundation.org>
Cc: ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
	Yuhao Jiang <danisjiang@gmail.com>, Mark Fasheh <mark@fasheh.com>,
	Joel Becker <jlbec@evilplan.org>,
	Sunil Mushran <sunil.mushran@oracle.com>
Subject: Re: [PATCH 2/2] ocfs2/dlm: fix off-by-one in dlm_match_regions() region comparison
Date: Wed, 18 Mar 2026 13:55:15 +0800	[thread overview]
Message-ID: <075f5ad1-6512-49cc-8959-daf733cc3d06@linux.alibaba.com> (raw)
In-Reply-To: <SYBPR01MB78813DA26B50EC5E01F00566AF7BA@SYBPR01MB7881.ausprd01.prod.outlook.com>



On 3/7/26 3:21 PM, Junrui Luo wrote:
> The local-vs-remote region comparison loop uses '<=' instead of '<',
> causing it to read one entry past the valid range of qr_regions. The
> other loops in the same function correctly use '<'.
> 
> Fix the loop condition to use '<' for consistency and correctness.
> 
> Fixes: ea2034416b54 ("ocfs2/dlm: Add message DLM_QUERY_REGION")
> Reported-by: Yuhao Jiang <danisjiang@gmail.com>
> Signed-off-by: Junrui Luo <moonafterrain@outlook.com>

Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> ---
>  fs/ocfs2/dlm/dlmdomain.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
> index 0a28cb5ded2a..dc9da9133c8e 100644
> --- a/fs/ocfs2/dlm/dlmdomain.c
> +++ b/fs/ocfs2/dlm/dlmdomain.c
> @@ -1002,7 +1002,7 @@ static int dlm_match_regions(struct dlm_ctxt *dlm,
>  	for (i = 0; i < localnr; ++i) {
>  		foundit = 0;
>  		r = remote;
> -		for (j = 0; j <= qr->qr_numregions; ++j) {
> +		for (j = 0; j < qr->qr_numregions; ++j) {
>  			if (!memcmp(l, r, O2HB_MAX_REGION_NAME_LEN)) {
>  				foundit = 1;
>  				break;
> 


  reply	other threads:[~2026-03-18  5:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-07  7:22 [PATCH 0/2] ocfs2/dlm: fix two bugs in dlm_match_regions() Junrui Luo
2026-03-07  7:21 ` [PATCH 1/2] ocfs2/dlm: validate qr_numregions " Junrui Luo
2026-03-18  5:54   ` Joseph Qi
2026-03-07  7:21 ` [PATCH 2/2] ocfs2/dlm: fix off-by-one in dlm_match_regions() region comparison Junrui Luo
2026-03-18  5:55   ` Joseph Qi [this message]
2026-03-07 16:06 ` [PATCH 0/2] ocfs2/dlm: fix two bugs in dlm_match_regions() Wengang Wang
2026-03-07 16:14   ` Wengang Wang
2026-03-09  1:26   ` Joseph Qi

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=075f5ad1-6512-49cc-8959-daf733cc3d06@linux.alibaba.com \
    --to=joseph.qi@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=danisjiang@gmail.com \
    --cc=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@fasheh.com \
    --cc=moonafterrain@outlook.com \
    --cc=ocfs2-devel@lists.linux.dev \
    --cc=sunil.mushran@oracle.com \
    /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®