2018-06-18 14:46:20

by Mika Westerberg

[permalink] [raw]
Subject: [PATCH] thunderbolt: Notify userspace when boot_acl is changed

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 <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>
---
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



2018-06-18 15:55:17

by Yehezkel Bernat

[permalink] [raw]
Subject: Re: [PATCH] thunderbolt: Notify userspace when boot_acl is changed

On Mon, Jun 18, 2018 at 5:44 PM Mika Westerberg
<[email protected]> 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 <[email protected]>
> Signed-off-by: Mika Westerberg <[email protected]>
> ---
> 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 <[email protected]>

2018-06-20 13:18:58

by Mika Westerberg

[permalink] [raw]
Subject: Re: [PATCH] thunderbolt: Notify userspace when boot_acl is changed

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 <[email protected]>
> Signed-off-by: Mika Westerberg <[email protected]>

Applied to thunderbolt.git/fixes.