From: hle@owl.eu.com (Hugo Lefeuvre) Date: Tue, 12 Jun 2018 20:58:07 -0400 Subject: [PATCH v2] staging: pi433: add mutex fixing concurrency issues. In-Reply-To: <20180612121107.xgxdqda5bzhqeizr@mwanda> References: <20180602175649.GA2816@hle-laptop.local> <20180607124216.GA2329@hle-laptop.local> <20180609081244.GP14048@gavran.carpriv.carnet.hr> <20180609154842.GB1826@hle-laptop.local> <20180612121107.xgxdqda5bzhqeizr@mwanda> Message-ID: <20180613005807.GB2265@hle-laptop.local> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org > > case PI433_IOC_WR_TX_CFG: > > if (copy_from_user(&instance->tx_cfg, argp, > > sizeof(struct pi433_tx_cfg))) > > return -EFAULT; > > break; > > Btw, it looks so wrong to me that we copy partial data to > &instance->tx_cfg... I'd really prefer copying it to a tmp buffer and > then verifying it's corrent then memcpy()ing it to &instance->tx_cfg. AFAIK this piece of code is not supposed to check passed tx config. These checks are realised later by rf69_set_tx_cfg (called by pi433_tx_thread) after the config has been written to the fifo by pi433_write. What kind of checks do you want to perform exactly ? But, right, I prefer the idea of the temporary buffer too, and seeing the rest of kernel code it seems to be the usual way to go. Regards, Hugo -- Hugo Lefeuvre (hle) | www.owl.eu.com 4096/ 9C4F C8BF A4B0 8FC5 48EB 56B8 1962 765B B9A8 BACA -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: not available URL: