lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <X/bRstJuBYaLz4PK@kroah.com>
Date:   Thu, 7 Jan 2021 10:17:38 +0100
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Prashant Malani <pmalani@...omium.org>
Cc:     linux-usb@...r.kernel.org,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Benson Leung <bleung@...omium.org>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: typec: Send uevent for num_altmodes update

On Wed, Jan 06, 2021 at 07:49:04PM -0800, Prashant Malani wrote:
> Generate a change uevent when the "number_of_alternate_modes" sysfs file
> for partners and plugs is updated by a port driver.
> 
> Cc: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
> Cc: Benson Leung <bleung@...omium.org>
> Signed-off-by: Prashant Malani <pmalani@...omium.org>
> ---
>  drivers/usb/typec/class.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index ebfd3113a9a8..8f77669f9cf4 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -766,6 +766,7 @@ int typec_partner_set_num_altmodes(struct typec_partner *partner, int num_altmod
>  		return ret;
>  
>  	sysfs_notify(&partner->dev.kobj, NULL, "number_of_alternate_modes");
> +	kobject_uevent(&partner->dev.kobj, KOBJ_CHANGE);

Shouldn't the sysfs_notify() handle the "something has changed" logic
good enough for userspace, as obviously someone is polling on the thing
(otherwise we wouldn't be calling sysfs_notify...)

The kobject itself hasn't "changed", but rather an individual attribute
has changed.  We don't want to create uevents for every individual sysfs
attribute changing values, do we?

What is preventing a normal "monitor the sysfs file" logic from working
here for anyone who wants to know that the alternate modes have changed?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ