* [patch net-next] dpll: check that pin is registered in __dpll_pin_unregister()
@ 2024-02-06 7:48 Jiri Pirko
2024-02-06 10:18 ` Vadim Fedorenko
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jiri Pirko @ 2024-02-06 7:48 UTC (permalink / raw)
To: netdev; +Cc: vadim.fedorenko, arkadiusz.kubalewski
From: Jiri Pirko <jiri@nvidia•com>
Similar to what is done in dpll_device_unregister(), add assertion to
__dpll_pin_unregister() to make sure driver does not try to unregister
non-registered pin.
Signed-off-by: Jiri Pirko <jiri@nvidia•com>
---
drivers/dpll/dpll_core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
index 61e5c607a72f..93c1bb7a6ef7 100644
--- a/drivers/dpll/dpll_core.c
+++ b/drivers/dpll/dpll_core.c
@@ -29,6 +29,8 @@ static u32 dpll_pin_xa_id;
WARN_ON_ONCE(!xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))
#define ASSERT_DPLL_NOT_REGISTERED(d) \
WARN_ON_ONCE(xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))
+#define ASSERT_DPLL_PIN_REGISTERED(p) \
+ WARN_ON_ONCE(!xa_get_mark(&dpll_pin_xa, (p)->id, DPLL_REGISTERED))
struct dpll_device_registration {
struct list_head list;
@@ -631,6 +633,7 @@ static void
__dpll_pin_unregister(struct dpll_device *dpll, struct dpll_pin *pin,
const struct dpll_pin_ops *ops, void *priv)
{
+ ASSERT_DPLL_PIN_REGISTERED(pin);
dpll_xa_ref_pin_del(&dpll->pin_refs, pin, ops, priv);
dpll_xa_ref_dpll_del(&pin->dpll_refs, dpll, ops, priv);
if (xa_empty(&pin->dpll_refs))
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [patch net-next] dpll: check that pin is registered in __dpll_pin_unregister()
2024-02-06 7:48 [patch net-next] dpll: check that pin is registered in __dpll_pin_unregister() Jiri Pirko
@ 2024-02-06 10:18 ` Vadim Fedorenko
2024-02-07 18:16 ` Kubalewski, Arkadiusz
2024-02-07 19:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Vadim Fedorenko @ 2024-02-06 10:18 UTC (permalink / raw)
To: Jiri Pirko, netdev; +Cc: arkadiusz.kubalewski
On 06/02/2024 07:48, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@nvidia•com>
>
> Similar to what is done in dpll_device_unregister(), add assertion to
> __dpll_pin_unregister() to make sure driver does not try to unregister
> non-registered pin.
>
> Signed-off-by: Jiri Pirko <jiri@nvidia•com>
> ---
> drivers/dpll/dpll_core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
> index 61e5c607a72f..93c1bb7a6ef7 100644
> --- a/drivers/dpll/dpll_core.c
> +++ b/drivers/dpll/dpll_core.c
> @@ -29,6 +29,8 @@ static u32 dpll_pin_xa_id;
> WARN_ON_ONCE(!xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))
> #define ASSERT_DPLL_NOT_REGISTERED(d) \
> WARN_ON_ONCE(xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))
> +#define ASSERT_DPLL_PIN_REGISTERED(p) \
> + WARN_ON_ONCE(!xa_get_mark(&dpll_pin_xa, (p)->id, DPLL_REGISTERED))
>
> struct dpll_device_registration {
> struct list_head list;
> @@ -631,6 +633,7 @@ static void
> __dpll_pin_unregister(struct dpll_device *dpll, struct dpll_pin *pin,
> const struct dpll_pin_ops *ops, void *priv)
> {
> + ASSERT_DPLL_PIN_REGISTERED(pin);
> dpll_xa_ref_pin_del(&dpll->pin_refs, pin, ops, priv);
> dpll_xa_ref_dpll_del(&pin->dpll_refs, dpll, ops, priv);
> if (xa_empty(&pin->dpll_refs))
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux•dev>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [patch net-next] dpll: check that pin is registered in __dpll_pin_unregister()
2024-02-06 7:48 [patch net-next] dpll: check that pin is registered in __dpll_pin_unregister() Jiri Pirko
2024-02-06 10:18 ` Vadim Fedorenko
@ 2024-02-07 18:16 ` Kubalewski, Arkadiusz
2024-02-07 19:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Kubalewski, Arkadiusz @ 2024-02-07 18:16 UTC (permalink / raw)
To: Jiri Pirko, netdev@vger•kernel.org; +Cc: vadim.fedorenko@linux•dev
>From: Jiri Pirko <jiri@resnulli•us>
>Sent: Tuesday, February 6, 2024 8:49 AM
>
>From: Jiri Pirko <jiri@nvidia•com>
>
>Similar to what is done in dpll_device_unregister(), add assertion to
>__dpll_pin_unregister() to make sure driver does not try to unregister
>non-registered pin.
>
>Signed-off-by: Jiri Pirko <jiri@nvidia•com>
>---
> drivers/dpll/dpll_core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
>diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
>index 61e5c607a72f..93c1bb7a6ef7 100644
>--- a/drivers/dpll/dpll_core.c
>+++ b/drivers/dpll/dpll_core.c
>@@ -29,6 +29,8 @@ static u32 dpll_pin_xa_id;
> WARN_ON_ONCE(!xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))
> #define ASSERT_DPLL_NOT_REGISTERED(d) \
> WARN_ON_ONCE(xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))
>+#define ASSERT_DPLL_PIN_REGISTERED(p) \
>+ WARN_ON_ONCE(!xa_get_mark(&dpll_pin_xa, (p)->id, DPLL_REGISTERED))
>
> struct dpll_device_registration {
> struct list_head list;
>@@ -631,6 +633,7 @@ static void
> __dpll_pin_unregister(struct dpll_device *dpll, struct dpll_pin *pin,
> const struct dpll_pin_ops *ops, void *priv)
> {
>+ ASSERT_DPLL_PIN_REGISTERED(pin);
> dpll_xa_ref_pin_del(&dpll->pin_refs, pin, ops, priv);
> dpll_xa_ref_dpll_del(&pin->dpll_refs, dpll, ops, priv);
> if (xa_empty(&pin->dpll_refs))
>--
>2.43.0
LGTM, Thank you!
Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel•com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch net-next] dpll: check that pin is registered in __dpll_pin_unregister()
2024-02-06 7:48 [patch net-next] dpll: check that pin is registered in __dpll_pin_unregister() Jiri Pirko
2024-02-06 10:18 ` Vadim Fedorenko
2024-02-07 18:16 ` Kubalewski, Arkadiusz
@ 2024-02-07 19:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-02-07 19:00 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, vadim.fedorenko, arkadiusz.kubalewski
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel•org>:
On Tue, 6 Feb 2024 08:48:53 +0100 you wrote:
> From: Jiri Pirko <jiri@nvidia•com>
>
> Similar to what is done in dpll_device_unregister(), add assertion to
> __dpll_pin_unregister() to make sure driver does not try to unregister
> non-registered pin.
>
> Signed-off-by: Jiri Pirko <jiri@nvidia•com>
>
> [...]
Here is the summary with links:
- [net-next] dpll: check that pin is registered in __dpll_pin_unregister()
https://git.kernel.org/netdev/net-next/c/9736c648370d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-07 19:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-06 7:48 [patch net-next] dpll: check that pin is registered in __dpll_pin_unregister() Jiri Pirko
2024-02-06 10:18 ` Vadim Fedorenko
2024-02-07 18:16 ` Kubalewski, Arkadiusz
2024-02-07 19:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox