]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit18c5496e40172df0a5f1fad45e1e52f5a8066ec9
tree79bde4ed7e0f77abc710dad35b2664ce1216ea24
parentfd874d57a07c0d411d020585f044f10676f54c30
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