From: Jiri Pirko <jiri@resnulli.us>
To: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Cc: netdev@vger.kernel.org, vadim.fedorenko@linux.dev,
michal.michalik@intel.com, milena.olech@intel.com,
pabeni@redhat.com, kuba@kernel.org
Subject: Re: [PATCH net 1/3] dpll: fix pin dump crash after module unbind
Date: Wed, 8 Nov 2023 16:08:42 +0100 [thread overview]
Message-ID: <ZUukeokxH2NVvmpe@nanopsycho> (raw)
In-Reply-To: <20231108103226.1168500-2-arkadiusz.kubalewski@intel.com>
Wed, Nov 08, 2023 at 11:32:24AM CET, arkadiusz.kubalewski@intel.com wrote:
>Disallow dump of unregistered parent pins, it is possible when parent
>pin and dpll device registerer kernel module instance unbinds, and
>other kernel module instances of the same dpll device have pins
>registered with the parent pin. The user can invoke a pin-dump but as
>the parent was unregistered, thus shall not be accessed by the
>userspace, prevent that by checking if parent pin is still registered.
>
>Fixes: 9d71b54b65b1 ("dpll: netlink: Add DPLL framework base functions")
>Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
>---
> drivers/dpll/dpll_netlink.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
>diff --git a/drivers/dpll/dpll_netlink.c b/drivers/dpll/dpll_netlink.c
>index a6dc3997bf5c..93fc6c4b8a78 100644
>--- a/drivers/dpll/dpll_netlink.c
>+++ b/drivers/dpll/dpll_netlink.c
>@@ -328,6 +328,13 @@ dpll_msg_add_pin_parents(struct sk_buff *msg, struct dpll_pin *pin,
> void *parent_priv;
>
> ppin = ref->pin;
>+ /*
>+ * dump parent only if it is registered, thus prevent crash on
>+ * pin dump called when driver which registered the pin unbinds
>+ * and different instance registered pin on that parent pin
Read this sentence like 10 times, still don't get what you mean.
Shouldn't comments be easy to understand?
>+ */
>+ if (!xa_get_mark(&dpll_pin_xa, ppin->id, DPLL_REGISTERED))
>+ continue;
> parent_priv = dpll_pin_on_dpll_priv(dpll_ref->dpll, ppin);
> ret = ops->state_on_pin_get(pin,
> dpll_pin_on_pin_priv(ppin, pin),
>--
>2.38.1
>
next prev parent reply other threads:[~2023-11-08 15:08 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-08 10:32 [PATCH net 0/3] dpll: fix unordered unbind/bind registerer issues Arkadiusz Kubalewski
2023-11-08 10:32 ` [PATCH net 1/3] dpll: fix pin dump crash after module unbind Arkadiusz Kubalewski
2023-11-08 11:36 ` Przemek Kitszel
2023-11-08 12:08 ` Kubalewski, Arkadiusz
2023-11-08 15:08 ` Jiri Pirko [this message]
2023-11-09 9:49 ` Kubalewski, Arkadiusz
2023-11-09 13:18 ` Jiri Pirko
2023-11-09 16:33 ` Kubalewski, Arkadiusz
2023-11-08 10:32 ` [PATCH net 2/3] dpll: fix pin dump crash for rebound module Arkadiusz Kubalewski
2023-11-08 14:30 ` Jiri Pirko
2023-11-09 12:20 ` Kubalewski, Arkadiusz
2023-11-09 13:19 ` Jiri Pirko
2023-11-09 16:30 ` Kubalewski, Arkadiusz
2023-11-09 18:06 ` Jiri Pirko
2023-11-09 23:32 ` Kubalewski, Arkadiusz
2023-11-10 6:45 ` Jiri Pirko
2023-11-10 9:01 ` Kubalewski, Arkadiusz
2023-11-10 10:06 ` Jiri Pirko
2023-11-10 11:18 ` Kubalewski, Arkadiusz
2023-11-10 11:44 ` Jiri Pirko
2023-11-10 14:11 ` Kubalewski, Arkadiusz
2023-11-08 10:32 ` [PATCH net 3/3] dpll: fix register pin with unregistered parent pin Arkadiusz Kubalewski
2023-11-08 15:07 ` Jiri Pirko
2023-11-09 9:59 ` Kubalewski, Arkadiusz
2023-11-09 10:56 ` Vadim Fedorenko
2023-11-09 16:02 ` Kubalewski, Arkadiusz
2023-11-09 18:04 ` Jiri Pirko
2023-11-09 23:21 ` Kubalewski, Arkadiusz
2023-11-10 6:48 ` Jiri Pirko
2023-11-10 8:50 ` Kubalewski, Arkadiusz
2023-11-10 10:07 ` Jiri Pirko
2023-11-10 11:19 ` Kubalewski, Arkadiusz
2023-11-09 13:20 ` Jiri Pirko
2023-11-09 16:13 ` Kubalewski, Arkadiusz
2023-11-09 10:50 ` [PATCH net 0/3] dpll: fix unordered unbind/bind registerer issues Vadim Fedorenko
2023-11-09 17:20 ` Kubalewski, Arkadiusz
2023-11-09 18:07 ` Jiri Pirko
2023-11-09 23:35 ` Kubalewski, Arkadiusz
2023-11-10 6:48 ` Jiri Pirko
2023-11-10 9:06 ` Kubalewski, Arkadiusz
2023-11-10 10:09 ` Jiri Pirko
2023-11-10 11:22 ` Kubalewski, Arkadiusz
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=ZUukeokxH2NVvmpe@nanopsycho \
--to=jiri@resnulli.us \
--cc=arkadiusz.kubalewski@intel.com \
--cc=kuba@kernel.org \
--cc=michal.michalik@intel.com \
--cc=milena.olech@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vadim.fedorenko@linux.dev \
/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;
as well as URLs for NNTP newsgroup(s).