Re: [PATCH v2] staging: pi433: fix race condition in pi433_ioctl

2018-06-13 Thread Hugo Lefeuvre
Hi Dan, > There is no need for this comment, since it's obvious. Also if you use > simpler names then the copy fits on one line: > > if (copy_from_user(_cfg, argp, sizeof(tx_cfg)) { > > > > + mutex_lock(>tx_fifo_lock); > > + if (copy_from_user(_cfg_buffer,

Re: [PATCH v2] staging: pi433: fix race condition in pi433_ioctl

2018-06-13 Thread Dan Carpenter
On Tue, Jun 12, 2018 at 09:47:41PM -0400, Hugo Lefeuvre wrote: > drivers/staging/pi433/pi433_if.c | 11 +-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/pi433/pi433_if.c > b/drivers/staging/pi433/pi433_if.c > index b061f77dda41..3ec1ed01d04b 100644

Re: [PATCH v2] staging: pi433: fix race condition in pi433_ioctl

2018-06-13 Thread Dan Carpenter
On Tue, Jun 12, 2018 at 09:47:41PM -0400, Hugo Lefeuvre wrote: > In the PI433_IOC_WR_TX_CFG case in pi433_ioctl, instance->tx_cfg is > modified via > > copy_from_user(>tx_cfg, argp, sizeof(struct pi433_tx_cfg))) > > without any kind of synchronization. In the case where two threads > would