From: Sudeep Holla <sudeep.holla@arm.com>
To: Cristian Marussi <cristian.marussi@arm.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH] firmware: arm_scmi: Fix duplicate workqueue name
Date: Wed, 14 Oct 2020 17:18:29 +0100 [thread overview]
Message-ID: <20201014160120.4x2l7hozf376gk3l@bogus> (raw)
In-Reply-To: <20201014134819.GA24061@e120937-lin>
On Wed, Oct 14, 2020 at 02:48:19PM +0100, Cristian Marussi wrote:
[...]
> >
> > I have pushed a version with above change [1], please check if you are
> > happy with that ?
> >
> > [1] https://git.kernel.org/sudeep.holla/linux/c/b2cd15549b
>
> I agree with the need to retain _notify name, but I'm not so sure about
> the above patch...which is:
>
I agree, I thought about it and just cooked up this as a quick solution.
I will move to that, even I wasn't happy with this TBH.
> diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c
> index c24e427dce0d7..f60fa630dd98f 100644
> --- a/drivers/firmware/arm_scmi/notify.c
> +++ b/drivers/firmware/arm_scmi/notify.c
> @@ -1461,6 +1461,7 @@ static const struct scmi_notify_ops notify_ops = {
> int scmi_notification_init(struct scmi_handle *handle)
> {
> void *gid;
> + char scmi_wq_name[32];
> struct scmi_notify_instance *ni;
>
> gid = devres_open_group(handle->dev, NULL, GFP_KERNEL);
> @@ -1474,7 +1475,8 @@ int scmi_notification_init(struct scmi_handle *handle)
> ni->gid = gid;
> ni->handle = handle;
>
> - ni->notify_wq = alloc_workqueue("scmi_notify",
> + sprintf(scmi_wq_name, "%s_notify", dev_name(handle->dev));
> + ni->notify_wq = alloc_workqueue(scmi_wq_name,
> WQ_UNBOUND | WQ_FREEZABLE | WQ_SYSFS,
> 0);
> if (!ni->notify_wq)
>
> ...does not expose a potential buffer overflow given that the dev_name now comes
> from the DT chosen name for this SCMI server instance ?
>
> I'd use snprintf and enlarge a bit the static scmi_wq_name[] to fit a max
> device bane plus "_notify".
>
> Regards
> Cristian
--
Regards,
Sudeep
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Sudeep Holla <sudeep.holla@arm.com>
To: Cristian Marussi <cristian.marussi@arm.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH] firmware: arm_scmi: Fix duplicate workqueue name
Date: Wed, 14 Oct 2020 17:18:29 +0100 [thread overview]
Message-ID: <20201014160120.4x2l7hozf376gk3l@bogus> (raw)
In-Reply-To: <20201014134819.GA24061@e120937-lin>
On Wed, Oct 14, 2020 at 02:48:19PM +0100, Cristian Marussi wrote:
[...]
> >
> > I have pushed a version with above change [1], please check if you are
> > happy with that ?
> >
> > [1] https://git.kernel.org/sudeep.holla/linux/c/b2cd15549b
>
> I agree with the need to retain _notify name, but I'm not so sure about
> the above patch...which is:
>
I agree, I thought about it and just cooked up this as a quick solution.
I will move to that, even I wasn't happy with this TBH.
> diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c
> index c24e427dce0d7..f60fa630dd98f 100644
> --- a/drivers/firmware/arm_scmi/notify.c
> +++ b/drivers/firmware/arm_scmi/notify.c
> @@ -1461,6 +1461,7 @@ static const struct scmi_notify_ops notify_ops = {
> int scmi_notification_init(struct scmi_handle *handle)
> {
> void *gid;
> + char scmi_wq_name[32];
> struct scmi_notify_instance *ni;
>
> gid = devres_open_group(handle->dev, NULL, GFP_KERNEL);
> @@ -1474,7 +1475,8 @@ int scmi_notification_init(struct scmi_handle *handle)
> ni->gid = gid;
> ni->handle = handle;
>
> - ni->notify_wq = alloc_workqueue("scmi_notify",
> + sprintf(scmi_wq_name, "%s_notify", dev_name(handle->dev));
> + ni->notify_wq = alloc_workqueue(scmi_wq_name,
> WQ_UNBOUND | WQ_FREEZABLE | WQ_SYSFS,
> 0);
> if (!ni->notify_wq)
>
> ...does not expose a potential buffer overflow given that the dev_name now comes
> from the DT chosen name for this SCMI server instance ?
>
> I'd use snprintf and enlarge a bit the static scmi_wq_name[] to fit a max
> device bane plus "_notify".
>
> Regards
> Cristian
--
Regards,
Sudeep
next prev parent reply other threads:[~2020-10-14 16:19 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-14 2:17 [PATCH] firmware: arm_scmi: Fix duplicate workqueue name Florian Fainelli
2020-10-14 2:17 ` Florian Fainelli
2020-10-14 9:18 ` Sudeep Holla
2020-10-14 9:18 ` Sudeep Holla
2020-10-14 13:05 ` Sudeep Holla
2020-10-14 13:05 ` Sudeep Holla
2020-10-14 13:48 ` Cristian Marussi
2020-10-14 13:48 ` Cristian Marussi
2020-10-14 16:18 ` Sudeep Holla [this message]
2020-10-14 16:18 ` Sudeep Holla
2020-10-14 17:13 ` Florian Fainelli
2020-10-14 17:13 ` Florian Fainelli
2020-10-14 17:39 ` Sudeep Holla
2020-10-14 17:39 ` Sudeep Holla
2020-10-14 18:11 ` Florian Fainelli
2020-10-14 18:11 ` Florian Fainelli
2020-10-14 17:08 ` Florian Fainelli
2020-10-14 17:08 ` Florian Fainelli
2020-10-14 17:32 ` Sudeep Holla
2020-10-14 17:32 ` Sudeep Holla
2020-10-14 17:35 ` Sudeep Holla
2020-10-14 17:35 ` Sudeep Holla
2020-10-14 20:29 ` Sudeep Holla
2020-10-14 20:29 ` Sudeep Holla
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=20201014160120.4x2l7hozf376gk3l@bogus \
--to=sudeep.holla@arm.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=cristian.marussi@arm.com \
--cc=f.fainelli@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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 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.