gfs2 filesystem and dlm development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alexander Aring" <aahringo@redhat.com>, teigland@redhat.com
Cc: gfs2@lists.linux.dev
Subject: Re: [PATCHv2 RESEND v7.4-rc3 3/5] dlm: don't publish a lkb in ls_lkbxa before it has an rsb
Date: Fri, 20 Nov 2026 20:12:30 +0000	[thread overview]
Message-ID: <sashiko-outbox-226014@kernel.org> (raw)
In-Reply-To: <20261120200040.257152-4-aahringo@redhat.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] dlm: __put_lkb() erases active ls_lkbxa entry on find_rsb()
  failure
--

commit c68d5fa6b30984a97220ff35d349c3276a988660
Author: Yogesh Gaur <yogeshgaur.83@gmail.com>

dlm: don't publish a lkb in ls_lkbxa before it has an rsb

This commit moves the allocation of lkb_id and insertion of the lkb into
ls_lkbxa from create_lkb() to attach_lkb() so that find_lkb() never returns
an lkb with a NULL lkb_resource.

> diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
> index c715e171bab7e..3b3e15157f4c9 100644
> --- a/fs/dlm/lock.c
> +++ b/fs/dlm/lock.c

[ ... ]

> @@ -6300,12 +6324,14 @@ int dlm_debug_add_lkb(struct dlm_ls *ls, uint32_t lkb_id, char *name, int len,
>  	if (!lksb)
>  		return -ENOMEM;
>  
> -	error = _create_lkb(ls, &lkb, lkb_id, lkb_id + 1);
> +	error = create_lkb(ls, &lkb);
>  	if (error) {
>  		kfree(lksb);
>  		return error;
>  	}
>  
> +	lkb->lkb_id = lkb_id;
> +
>  	dlm_set_dflags_val(lkb, lkb_dflags);
>  	lkb->lkb_nodeid = lkb_nodeid;
>  	lkb->lkb_lksb = lksb;
> @@ -6321,7 +6347,15 @@ int dlm_debug_add_lkb(struct dlm_ls *ls, uint32_t lkb_id, char *name, int len,
>  	}

[Severity: Medium]
Can setting lkb->lkb_id before find_rsb() cause __put_lkb() to erase an
existing lkb's entry in ls_lkbxa if find_rsb() fails?

attach_lkb() clears lkb->lkb_id on failure for that reason, but if
find_rsb() fails first (for example, with -EINVAL when len >
DLM_RESNAME_MAXLEN), dlm_debug_add_lkb() calls __put_lkb(ls, lkb) while
lkb->lkb_id still holds the caller-supplied id, and xa_erase() removes any
live lkb already occupying that id from ls_lkbxa.  Setting lkb->lkb_id
right before attach_lkb() would avoid this.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261120200040.257152-1-aahringo@redhat.com?part=3

  reply	other threads:[~2026-11-20 20:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 20:00 [PATCHv2 RESEND v7.4-rc3 0/5] dlm: various fixes Alexander Aring
2026-11-20 20:00 ` [PATCHv2 RESEND v7.4-rc3 1/5] dlm: fix socket hang on send buffer limitation with socket error Alexander Aring
2026-11-20 20:40   ` sashiko-bot
2026-11-20 20:00 ` [PATCHv2 RESEND v7.4-rc3 2/5] dlm: reject wrapped messages with oversized inner lengths Alexander Aring
2026-11-20 20:00 ` [PATCHv2 RESEND v7.4-rc3 3/5] dlm: don't publish a lkb in ls_lkbxa before it has an rsb Alexander Aring
2026-11-20 20:12   ` sashiko-bot [this message]
2026-11-20 20:00 ` [PATCHv2 RESEND v7.4-rc3 4/5] dlm: don't set RSB_MASTER_UNCERTAIN on rsb with no master Alexander Aring
2026-11-20 20:00 ` [PATCHv2 RESEND v7.4-rc3 5/5] dlm: fix memory leak on active leaving member Alexander Aring

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=sashiko-outbox-226014@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=aahringo@redhat.com \
    --cc=gfs2@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=teigland@redhat.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