From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,
netdev@vger.kernel.org
Cc: jiri@resnulli.us, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
pierre@stackhpc.com, hkallweit1@gmail.com, linux@armlinux.org.uk,
maxime.chevallier@bootlin.com, christophe.leroy@csgroup.eu,
arkadiusz.kubalewski@intel.com
Subject: Re: [PATCH net v2 2/3] dpll: fix xa_alloc_cyclic() error handling
Date: Wed, 12 Mar 2025 10:33:52 +0000 [thread overview]
Message-ID: <e2d9d908-0103-417c-9087-c8b9030b2fbb@linux.dev> (raw)
In-Reply-To: <20250312095251.2554708-3-michal.swiatkowski@linux.intel.com>
On 12/03/2025 09:52, Michal Swiatkowski wrote:
> In case of returning 1 from xa_alloc_cyclic() (wrapping) ERR_PTR(1) will
> be returned, which will cause IS_ERR() to be false. Which can lead to
> dereference not allocated pointer (pin).
>
> Fix it by checking if err is lower than zero.
>
> This wasn't found in real usecase, only noticed. Credit to Pierre.
>
> Fixes: 97f265ef7f5b ("dpll: allocate pin ids in cycle")
> Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> ---
> drivers/dpll/dpll_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
> index 32019dc33cca..1877201d1aa9 100644
> --- a/drivers/dpll/dpll_core.c
> +++ b/drivers/dpll/dpll_core.c
> @@ -505,7 +505,7 @@ dpll_pin_alloc(u64 clock_id, u32 pin_idx, struct module *module,
> xa_init_flags(&pin->parent_refs, XA_FLAGS_ALLOC);
> ret = xa_alloc_cyclic(&dpll_pin_xa, &pin->id, pin, xa_limit_32b,
> &dpll_pin_xa_id, GFP_KERNEL);
> - if (ret)
> + if (ret < 0)
> goto err_xa_alloc;
> return pin;
> err_xa_alloc:
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
next prev parent reply other threads:[~2025-03-12 10:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-12 9:52 [PATCH net v2 0/3] fix xa_alloc_cyclic() return checks Michal Swiatkowski
2025-03-12 9:52 ` [PATCH net v2 1/3] devlink: fix xa_alloc_cyclic() error handling Michal Swiatkowski
2025-03-12 13:15 ` Andrew Lunn
2025-03-14 13:33 ` Jiri Pirko
2025-03-12 9:52 ` [PATCH net v2 2/3] dpll: " Michal Swiatkowski
2025-03-12 10:33 ` Vadim Fedorenko [this message]
2025-03-12 10:55 ` Kubalewski, Arkadiusz
2025-03-14 13:33 ` Jiri Pirko
2025-03-12 9:52 ` [PATCH net v2 3/3] phy: " Michal Swiatkowski
2025-03-12 11:35 ` Maxime Chevallier
2025-03-14 10:23 ` [PATCH net v2 0/3] fix xa_alloc_cyclic() return checks Dan Carpenter
2025-03-14 12:52 ` Przemek Kitszel
2025-03-14 14:13 ` Dan Carpenter
2025-03-14 14:23 ` Matthew Wilcox
2025-03-17 8:55 ` Przemek Kitszel
2025-03-17 12:24 ` Matthew Wilcox
2025-03-19 8:45 ` Przemek Kitszel
2025-03-19 10:00 ` patchwork-bot+netdevbpf
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=e2d9d908-0103-417c-9087-c8b9030b2fbb@linux.dev \
--to=vadim.fedorenko@linux.dev \
--cc=arkadiusz.kubalewski@intel.com \
--cc=christophe.leroy@csgroup.eu \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maxime.chevallier@bootlin.com \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pierre@stackhpc.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.