From: Simon Horman <horms@kernel.org>
To: Linkui Xiao <xiaolinkui@126.com>
Cc: jiri@resnulli.us, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Linkui Xiao <xiaolinkui@kylinos.cn>
Subject: Re: [PATCH net 2/2] devlink: sb: do not dereference a missing shared buffer
Date: Mon, 2 Nov 2026 12:02:30 +0000 [thread overview]
Message-ID: <20261102120230.GC257209@horms.kernel.org> (raw)
In-Reply-To: <20261030033332.3685172-3-xiaolinkui@126.com>
On Fri, Oct 30, 2026 at 11:33:32AM +0800, Linkui Xiao wrote:
> From: Linkui Xiao <xiaolinkui@kylinos.cn>
>
> devl_sb_unregister() looks the shared buffer up by index and only warns
> when it is not on the list. list_del() and kfree() are then called on the
> NULL result, so unregistering an index that was never registered, or
> unregistering the same index twice, turns the warning into a NULL pointer
> dereference. list is the first member of struct devlink_sb, so list_del()
> reads the next and prev pointers from address 0 before storing to them.
>
> The register side already fails gracefully: devl_sb_register() returns
> -EEXIST when the index is taken. Make the unregister side symmetric and
> return after the warning.
>
> Fixes: bf7974710a40 ("devlink: add shared buffer configuration")
> Signed-off-by: Linkui Xiao <xiaolinkui@kylinos.cn>
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2026-11-02 12:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 3:33 [PATCH net 0/2] devlink: do not dereference a missing param item or " Linkui Xiao
2026-10-30 3:33 ` [PATCH net 1/2] devlink: param: do not dereference a missing param item Linkui Xiao
2026-11-02 12:02 ` Simon Horman
2026-10-30 3:33 ` [PATCH net 2/2] devlink: sb: do not dereference a missing shared buffer Linkui Xiao
2026-11-02 12:02 ` Simon Horman [this message]
2026-11-02 12:05 ` [PATCH net 0/2] devlink: do not dereference a missing param item or " Simon Horman
2026-11-02 13:12 ` Linkui Xiao
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=20261102120230.GC257209@horms.kernel.org \
--to=horms@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=xiaolinkui@126.com \
--cc=xiaolinkui@kylinos.cn \
/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®