rmnet_data: Fix use-after-free in rmnet_vnd_create_dev

Currently it is possible for rmnet_vnd_create_dev to update features on
a free'd device in case of device registraton failure.

Fix this issue by updating features only on successful netdevice
registration.

Change-Id: Idbd50f91377206a73ef4105d35b2f5e8cc065a07
Signed-off-by: Ashwanth Goli <ashwanth@codeaurora.org>
This commit is contained in:
Ashwanth Goli 2018-05-09 20:28:24 +05:30
commit 6de7e0976a

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -578,7 +578,7 @@ int rmnet_vnd_create_dev(int id, struct net_device **new_device,
LOGE("Failed to to register netdev [%s]", dev->name);
free_netdev(dev);
*new_device = 0;
rc = RMNET_CONFIG_UNKNOWN_ERROR;
return RMNET_CONFIG_UNKNOWN_ERROR;
} else {
rmnet_devices[id] = dev;
*new_device = dev;