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: <1506439955.1860.46.camel@codethink.co.uk>
Date:   Tue, 26 Sep 2017 16:32:35 +0100
From:   Ben Hutchings <ben.hutchings@...ethink.co.uk>
To:     Jeffy Chen <jeffy.chen@...k-chips.com>,
        Marcel Holtmann <marcel@...tmann.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        AL Yu-Chen Cho <acho@...e.com>,
        Rohit Vaswani <rvaswani@...dia.com>,
        Jiri Slaby <jslaby@...e.cz>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH 4.4 35/53] Bluetooth: hidp: fix possible might sleep
 error in hidp_session_thread

On Mon, 2017-08-28 at 10:05 +0200, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Jeffy Chen <jeffy.chen@...k-chips.com>
> 
> commit 5da8e47d849d3d37b14129f038782a095b9ad049 upstream.
> 
> It looks like hidp_session_thread has same pattern as the issue reported in
> old rfcomm:
> 
> 	while (1) {
> 		set_current_state(TASK_INTERRUPTIBLE);
> 		if (condition)
> 			break;
> 		// may call might_sleep here
> 		schedule();
> 	}
> 	__set_current_state(TASK_RUNNING);
> 
> Which fixed at:
> 	dfb2fae Bluetooth: Fix nested sleeps
> 
> So let's fix it at the same way, also follow the suggestion of:
> https://lwn.net/Articles/628628/
> 
> Signed-off-by: Jeffy Chen <jeffy.chen@...k-chips.com>
> Tested-by: AL Yu-Chen Cho <acho@...e.com>
> Tested-by: Rohit Vaswani <rvaswani@...dia.com>
> Signed-off-by: Marcel Holtmann <marcel@...tmann.org>
> Cc: Jiri Slaby <jslaby@...e.cz>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> 
> ---
>  net/bluetooth/hidp/core.c |   33 ++++++++++++++++++++++-----------
>  1 file changed, 22 insertions(+), 11 deletions(-)
> 
> --- a/net/bluetooth/hidp/core.c
> +++ b/net/bluetooth/hidp/core.c
[...]
> +		/* Ensure session->terminate is updated */
> +		smp_mb__before_atomic();
>  		if (atomic_read(&session->terminate))
>  			break;
[...]

smp_mb__before_atomic() is only meant to avoid adding a redundant
barrier next to an atomic RMW operation if it already includes one
(which is arch-dependent).   atomic_read() is not an RMW operation and
never includes a barrier, so it needs an smp_mb() before it.

Ben.

-- 
Ben Hutchings
Software Developer, Codethink Ltd.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ