ppp: ensure file->private_data can't be overridden
authorGuillaume Nault <g.nault@alphalink.fr>
Mon, 14 Mar 2016 20:17:16 +0000 (21:17 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Mar 2016 23:35:06 +0000 (19:35 -0400)
commite8e56ffd9d2973398b60ece1f1bebb8d67b4d032
tree06154afcd07d48f65e66a388f0f8634efdd6cfbf
parentc8f5d29899901cea94bf4b8cf721e1b83e51174e
ppp: ensure file->private_data can't be overridden

Locking ppp_mutex must be done before dereferencing file->private_data,
otherwise it could be modified before ppp_unattached_ioctl() takes the
lock. This could lead ppp_unattached_ioctl() to override ->private_data,
thus leaking reference to the ppp_file previously pointed to.

v2: lock all ppp_ioctl() instead of just checking private_data in
    ppp_unattached_ioctl(), to avoid ambiguous behaviour.

Fixes: f3ff8a4d80e8 ("ppp: push BKL down into the driver")
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ppp/ppp_generic.c