[PATCH 2/7] [Bionic] thunderbolt: Notify userspace when boot_acl is changed

Kai-Heng Feng kai.heng.feng at canonical.com
Tue Aug 28 06:43:08 UTC 2018

From: Mika Westerberg <mika.westerberg at linux.intel.com>

BugLink: https://bugs.launchpad.net/bugs/1789358

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-and-tested-by: Christian Kellner <christian at kellner.me>
Signed-off-by: Mika Westerberg <mika.westerberg at linux.intel.com>
Reviewed-by: Christian Kellner <christian at kellner.me>
Acked-by: Yehezkel Bernat <yehezkelshb at gmail.com>
Cc: stable at vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
(cherry picked from commit 007a74907deeceefef9dc3ec4679fbd7921eaa51)
Signed-off-by: Kai-Heng Feng <kai.heng.feng at canonical.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);
+	}

More information about the kernel-team mailing list