Prevent premature device free in interface_claim_device
authorFelix Fietkau <nbd@nbd.name>
Thu, 11 Aug 2016 17:36:09 +0000 (19:36 +0200)
committerFelix Fietkau <nbd@nbd.name>
Thu, 11 Aug 2016 17:36:12 +0000 (19:36 +0200)
commitc8a5f1ae361ab61192be6085c29d977eb73a05f5
tree65918e9f440b766a29b4d68e80bf8c4dc59691fb
parentcec1ce296eede81dc62628fce33b8cc216727b17
Prevent premature device free in interface_claim_device

interface_set_device_config can trigger a device free (for example
if the device is here only present in a bridge), which renders dev
invalid and leads to segfault. Add a lock to prevent this and
clean-up the code for readability.

Signed-off-by: Gino Peeters <peeters.gino@gmail.com>
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
interface.c