mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jyun-An Chen <jun930436@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Jyun-An Chen <jun930436@gmail.com>
Subject: [PATCH 0/2] lib/btree: fix two bugs with key 0
Date: Sun,  6 Dec 2026 07:07:21 +0800	[thread overview]
Message-ID: <20261205230723.96179-1-jun930436@gmail.com> (raw)

Unused slots in a lib/btree node hold key 0, and inner node keys can
be lowered to 0, so key 0 is not handled correctly in two places.
Patch 1 fixes btree_remove() of a key 0 that is not in the tree, which
drops another entry from the tree and can write in front of the node.
Patch 2 fixes btree_get_prev() wrapping around below key 0, which makes
a btree_for_each_safe*() loop never terminate.

The only in-tree user of lib/btree is qla2xxx, and I could not find a
path there that hits either bug, so this is not known to fix a problem
that users see today.  Key 0 is a valid key, though, and these fixes
keep a future user of the library from running into them.

Jyun-An Chen (2):
  lib/btree: fix btree_remove() of a key 0 that is not in the tree
  lib/btree: stop btree_get_prev() from wrapping around below key 0

 lib/btree.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4

             reply	other threads:[~2026-12-05 23:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05 23:07 Jyun-An Chen [this message]
2026-12-05 23:07 ` [PATCH 1/2] lib/btree: fix btree_remove() of a key 0 that is not in the tree Jyun-An Chen
2026-12-05 23:07 ` [PATCH 2/2] lib/btree: stop btree_get_prev() from wrapping around below key 0 Jyun-An Chen

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=20261205230723.96179-1-jun930436@gmail.com \
    --to=jun930436@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.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®