From: Guillaume Nault <g.na...@alphalink.fr> Date: Tue, 8 Mar 2016 20:14:30 +0100
> Lock ppp_mutex and check that file->private_data is NULL before > executing any action in ppp_unattached_ioctl(). > The test done by ppp_ioctl() can't be relied upon, because > file->private_data may have been updated meanwhile. In which case > ppp_unattached_ioctl() will override file->private_data and mess up > reference counters or loose pointer to previously allocated PPP unit. > > In case the test fails, -ENOTTY is returned, just like if ppp_ioctl() > had rejected the ioctl in the first place. > > Signed-off-by: Guillaume Nault <g.na...@alphalink.fr> If this thing can disappear on us, then we need to make the entirety of ppp_ioctl() run with the mutex held to fix this properly. Otherwise ->private_data could go NULL on us meanwhile as well. We should hold the mutex, to stabilize the value of ->private_data.