OSDN Git Service

staging: pi433: fix race condition in pi433_open
authorHugo Lefeuvre <hle@owl.eu.com>
Wed, 20 Jun 2018 13:37:19 +0000 (09:37 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Jun 2018 13:00:13 +0000 (22:00 +0900)
commit983000d7fa5d7538915810b58c9e63cb6118eb1e
tree79bde4ed7e0f77abc710dad35b2664ce1216ea24
parent10c553b154c725e27da2f09e45692222f97beb6e
staging: pi433: fix race condition in pi433_open

The device structure contains a useless non-atomic users counter which
is subject to race conditions. It has probably been created to handle
the case where remove is executed while operations are still executing
on open fds but this will never happen because of reference counts.

Drop the users counter and move rx buffer {de,}allocation to probe()
and remove(). Remove associated dead code from open() and release().
Remove related TODO entry from ioctl().

Signed-off-by: Hugo Lefeuvre <hle@owl.eu.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/pi433/pi433_if.c