From: hle@owl.eu.com (Hugo Lefeuvre) Date: Wed, 30 May 2018 21:44:32 -0400 Subject: develoment workflow: how to avoid duplicate work ? In-Reply-To: <22501.1527692619@turing-police.cc.vt.edu> References: <20180529030706.GD1845@hle-laptop.local> <80132.1527564735@turing-police.cc.vt.edu> <20180530025657.GB1919@hle-laptop.local> <22501.1527692619@turing-police.cc.vt.edu> Message-ID: <20180531014432.GA3722@hle-laptop.local> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org > > For example the TODO entry at line 876: If pi433_release() is > > called while pi433_ioctl() is executing between lines 879 and > > 880, we might perform a NULL pointer dereference, right ? > > Yes, no, maybe. That's what kernel locks are for. Is that data > protected against concurrent access by a lock of some sort? No, I don't think so. The release function doesn't ask for any kind of lock before freeing that data, nor does the ioctl function. Also, this ioctl function is unlocked_ioctl, so AFAIK it should be self responsible for locking/synchronization stuff (most docs I've read are getting pretty old now, from the 2.6 times where the BKL was still something 'common' and lots of drivers were still using ioctl(), but I don't think it's the case anymore). So, if pi433_release() and pi433_ioctl() can be concurrently executed then this issue might happen. I'll submit a patch. Thanks ! Cheers, 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: