[PATCH 1/7] staging: unisys: visornic: fix serialization mechanism around usage atomic

Greg KH gregkh at linuxfoundation.org
Fri Jul 24 20:35:51 UTC 2015


On Fri, Jul 24, 2015 at 12:00:19PM -0400, Benjamin Romer wrote:
> From: Neil Horman <nhorman at redhat.com>
> 
> Missed this in my initial review.  The usage counter that guards against
> kthread task is horribly racy.  The atomic is self consistent, but theres
> nothing that prevents the service_resp_queue function from re-incrementing
> it immediately after the check in disable_with_timeout is complete.  Its
> just a improper usage of atomics as a serialization mechanism.
> 
> Instead use kthread_park to pause the thread in its activity so that
> buffers can be properly freed without racing against usage in
> service_resp_queue
> 
> Signed-off-by: Neil Horman <nhorman at redhat.com>
> Signed-off-by: Benjamin Romer <benjamin.romer at unisys.com>
> ---
>  drivers/staging/unisys/visornic/visornic_main.c | 23 ++++++-----------------
>  kernel/kthread.c                                |  4 ++++

Sorry, staging drivers can not modify other parts of the kernel.  Adding
exports for these kthread functions needs to happen as a "real" patch
that the kthread maintainer accepts, I can't take this.

greg k-h


More information about the devel mailing list