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  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]
Date:   Sat, 9 May 2020 11:24:08 +0800
From:   Wen Yang <wenyang@...ux.alibaba.com>
To:     Bryan O'Donoghue <bryan.odonoghue@...aro.org>,
        heikki.krogerus@...ux.intel.com, gregkh@...uxfoundation.org,
        linux-usb@...r.kernel.org
Cc:     Chunfeng Yun <chunfeng.yun@...iatek.com>,
        Suzuki K Poulose <suzuki.poulose@....com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        chenqiwu <chenqiwu@...omi.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: roles: Switch on role-switch uevent reporting



在 2020/5/9 上午12:29, Bryan O'Donoghue 写道:
> Right now we don't report to user-space a role switch when doing a
> usb_role_switch_set_role() despite having registered the uevent callbacks.
> 
> This patch switches on the notifications allowing user-space to see
> role-switch change notifications and subsequently determine the current
> controller data-role.
> 
> example:
> PFX=/devices/platform/soc/78d9000.usb/ci_hdrc.0
> 
> root@...ebox# udevadm monitor -p
> 
> KERNEL[49.894994] change $PFX/usb_role/ci_hdrc.0-role-switch (usb_role)
> ACTION=change
> DEVPATH=$PFX/usb_role/ci_hdrc.0-role-switch
> SUBSYSTEM=usb_role
> DEVTYPE=usb_role_switch
> USB_ROLE_SWITCH=ci_hdrc.0-role-switch
> SEQNUM=2432
> 
> Cc: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: Chunfeng Yun <chunfeng.yun@...iatek.com>
> Cc: Suzuki K Poulose <suzuki.poulose@....com>
> Cc: Alexandre Belloni <alexandre.belloni@...tlin.com>
> Cc: Wen Yang <wenyang@...ux.alibaba.com>
> Cc: chenqiwu <chenqiwu@...omi.com>
> Cc: linux-kernel@...r.kernel.org
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@...aro.org>
> ---
>   drivers/usb/roles/class.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/roles/class.c b/drivers/usb/roles/class.c
> index 5b17709821df..27d92af29635 100644
> --- a/drivers/usb/roles/class.c
> +++ b/drivers/usb/roles/class.c
> @@ -49,8 +49,10 @@ int usb_role_switch_set_role(struct usb_role_switch *sw, enum usb_role role)
>   	mutex_lock(&sw->lock);
>   
>   	ret = sw->set(sw, role);
> -	if (!ret)
> +	if (!ret) {
>   		sw->role = role;
> +		kobject_uevent(&sw->dev.kobj, KOBJ_CHANGE);
> +	}
>   
>   	mutex_unlock(&sw->lock);
>   
> 

Hi, we may also need to deal with the return value of kobject_uevent(). 
Should we move it under the line mutex_unlock(&sw->lock)?

Regards,
Wen

Powered by blists - more mailing lists