mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Abdurrahman Hussain" <abdurrahman@nexthop.ai>
To: "Geert Uytterhoeven" <geert@linux-m68k.org>
Cc: <robh@kernel.org>, <saravanak@kernel.org>,
	<frowand.list@gmail.com>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 5/9] of/overlay: don't keep a negative id in ovcs->id on idr_alloc() failure
Date: Wed, 05 Aug 2026 11:47:53 -0700	[thread overview]
Message-ID: <DKH8G5UIHT8H.25XKJIEKX4XTQ@nexthop.ai> (raw)
In-Reply-To: <CAMuHMdUG0RH6sFpBxp-dXw4S8kdS0oyyCL=wzKE=TkheWQAs=w@mail.gmail.com>

On Wed Aug 5, 2026 at 1:26 AM PDT, Geert Uytterhoeven wrote:
> (Alternatively, free_overlay_changeset() could check for a
> strict-positive id)
>
> However, I am wondering if this is the right fix?
>
> All error cases above just return an error code, without doing
> any cleanup. Failing to allocate an ID doesn't add any extra state...
>
> > goto err_free_ovcs;
>
> ... so shouldn't this just be changed to "goto out_unlock" instead?

ovcs itself is already allocated at that point, and out_unlock does
not free it, so that would leak the kzalloc. Going through
free_overlay_changeset() is intentional: it copes with a partially
initialized ovcs (the cset.entries.next check, the id check, and
notify_state == OF_OVERLAY_INIT from kzalloc) and frees the struct.

Your alternative is nicer though: the next revision makes
free_overlay_changeset() treat only a strict-positive id as
registered and drops the reset at the error site. Added your
Suggested-by.

Thanks,
Abdurrahman

  reply	other threads:[~2026-08-05 18:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23  3:19 [PATCH v5 0/9] of: teach overlay code to keep /aliases in sync Abdurrahman Hussain
2026-07-23  3:19 ` [PATCH v5 1/9] of: hold a reference on of_aliases during alias path resolution Abdurrahman Hussain
     [not found]   ` <20260723033554.022251F00A3A@smtp.kernel.org>
2026-07-23 17:07     ` Abdurrahman Hussain
2026-07-23  3:19 ` [PATCH v5 2/9] of: update /aliases lookup on reconfig notifications Abdurrahman Hussain
2026-08-05  8:34   ` Geert Uytterhoeven
2026-08-05 18:35     ` Abdurrahman Hussain
2026-07-23  3:19 ` [PATCH v5 3/9] of/overlay: look up absolute target-paths absolutely Abdurrahman Hussain
2026-07-23  3:19 ` [PATCH v5 4/9] of/overlay: put property on deadprops only after changeset add succeeds Abdurrahman Hussain
2026-07-23  3:19 ` [PATCH v5 5/9] of/overlay: don't keep a negative id in ovcs->id on idr_alloc() failure Abdurrahman Hussain
2026-08-05  8:26   ` Geert Uytterhoeven
2026-08-05 18:47     ` Abdurrahman Hussain [this message]
2026-08-06  7:50       ` Geert Uytterhoeven
2026-07-23  3:19 ` [PATCH v5 6/9] of/overlay: don't create "//" paths for fragments targeting the root Abdurrahman Hussain
     [not found]   ` <20260723033553.1261D1F000E9@smtp.kernel.org>
2026-07-23 17:07     ` Abdurrahman Hussain
2026-07-23  3:19 ` [PATCH v5 7/9] of/overlay: return ERR_PTR from dup_and_fixup_symbol_prop() Abdurrahman Hussain
2026-07-23  3:19 ` [PATCH v5 8/9] of/overlay: rewrite /aliases path values to live-tree paths Abdurrahman Hussain
2026-07-23  3:19 ` [PATCH v5 9/9] of: unittest: cover /aliases updates from overlay apply/revert Abdurrahman Hussain

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=DKH8G5UIHT8H.25XKJIEKX4XTQ@nexthop.ai \
    --to=abdurrahman@nexthop.ai \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=saravanak@kernel.org \
    /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®