linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thunderbolt: Notify userspace when boot_acl is changed
@ 2018-06-18 14:44 Mika Westerberg
  2018-06-18 15:54 ` Yehezkel Bernat
  2018-06-20 13:17 ` Mika Westerberg
  0 siblings, 2 replies; 3+ messages in thread
From: Mika Westerberg @ 2018-06-18 14:44 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andreas Noever, Michael Jamet, Yehezkel Bernat,
	Christian Kellner, Mario Limonciello, Lukas Wunner,
	Mika Westerberg

The commit 9aaa3b8b4c56 ("thunderbolt: Add support for preboot ACL")
introduced boot_acl attribute but missed the fact that now userspace
needs to poll the attribute constantly to find out whether it has
changed or not. Fix this by sending notification to the userspace
whenever the boot_acl attribute is changed.

Fixes: 9aaa3b8b4c56 ("thunderbolt: Add support for preboot ACL")
Reported-by: Christian Kellner <ckellner@redhat.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/thunderbolt/domain.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/thunderbolt/domain.c b/drivers/thunderbolt/domain.c
index 6281266b8ec0..a923ebdeb73c 100644
--- a/drivers/thunderbolt/domain.c
+++ b/drivers/thunderbolt/domain.c
@@ -213,6 +213,10 @@ static ssize_t boot_acl_store(struct device *dev, struct device_attribute *attr,
 		goto err_free_acl;
 	}
 	ret = tb->cm_ops->set_boot_acl(tb, acl, tb->nboot_acl);
+	if (!ret) {
+		/* Notify userspace about the change */
+		kobject_uevent(&tb->dev.kobj, KOBJ_CHANGE);
+	}
 	mutex_unlock(&tb->lock);
 
 err_free_acl:
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] thunderbolt: Notify userspace when boot_acl is changed
  2018-06-18 14:44 [PATCH] thunderbolt: Notify userspace when boot_acl is changed Mika Westerberg
@ 2018-06-18 15:54 ` Yehezkel Bernat
  2018-06-20 13:17 ` Mika Westerberg
  1 sibling, 0 replies; 3+ messages in thread
From: Yehezkel Bernat @ 2018-06-18 15:54 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: LKML, Andreas Noever, michael.jamet, christian, Mario Limonciello, lukas

On Mon, Jun 18, 2018 at 5:44 PM Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
>
> The commit 9aaa3b8b4c56 ("thunderbolt: Add support for preboot ACL")
> introduced boot_acl attribute but missed the fact that now userspace
> needs to poll the attribute constantly to find out whether it has
> changed or not. Fix this by sending notification to the userspace
> whenever the boot_acl attribute is changed.
>
> Fixes: 9aaa3b8b4c56 ("thunderbolt: Add support for preboot ACL")
> Reported-by: Christian Kellner <ckellner@redhat.com>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> ---
>  drivers/thunderbolt/domain.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/thunderbolt/domain.c b/drivers/thunderbolt/domain.c
> index 6281266b8ec0..a923ebdeb73c 100644
> --- a/drivers/thunderbolt/domain.c
> +++ b/drivers/thunderbolt/domain.c
> @@ -213,6 +213,10 @@ static ssize_t boot_acl_store(struct device *dev, struct device_attribute *attr,
>                 goto err_free_acl;
>         }
>         ret = tb->cm_ops->set_boot_acl(tb, acl, tb->nboot_acl);
> +       if (!ret) {
> +               /* Notify userspace about the change */
> +               kobject_uevent(&tb->dev.kobj, KOBJ_CHANGE);
> +       }
>         mutex_unlock(&tb->lock);
>
>  err_free_acl:
> --
> 2.17.1
>

Acked-by: Yehezkel Bernat <yehezkelshb@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] thunderbolt: Notify userspace when boot_acl is changed
  2018-06-18 14:44 [PATCH] thunderbolt: Notify userspace when boot_acl is changed Mika Westerberg
  2018-06-18 15:54 ` Yehezkel Bernat
@ 2018-06-20 13:17 ` Mika Westerberg
  1 sibling, 0 replies; 3+ messages in thread
From: Mika Westerberg @ 2018-06-20 13:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andreas Noever, Michael Jamet, Yehezkel Bernat,
	Christian Kellner, Mario Limonciello, Lukas Wunner

On Mon, Jun 18, 2018 at 05:44:04PM +0300, Mika Westerberg wrote:
> The commit 9aaa3b8b4c56 ("thunderbolt: Add support for preboot ACL")
> introduced boot_acl attribute but missed the fact that now userspace
> needs to poll the attribute constantly to find out whether it has
> changed or not. Fix this by sending notification to the userspace
> whenever the boot_acl attribute is changed.
> 
> Fixes: 9aaa3b8b4c56 ("thunderbolt: Add support for preboot ACL")
> Reported-by: Christian Kellner <ckellner@redhat.com>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Applied to thunderbolt.git/fixes.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-20 13:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-18 14:44 [PATCH] thunderbolt: Notify userspace when boot_acl is changed Mika Westerberg
2018-06-18 15:54 ` Yehezkel Bernat
2018-06-20 13:17 ` Mika Westerberg

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).