On Fri, Apr 12, 2019 at 04:36:34PM -0400, Wang Hai wrote:Thanks. I'll take a closer look at the code to see when it's time to call put_device(). It's really not easy to fix.
+error_register:When put_device() will be called on this it will go to double free (in case of
+ device_del(dev);
+error_device_add:
+ kfree_const(dev->kobj.name);
return error;
dynamically allocated dev->kobj.name.
Al Viro and me suggested earlier that the correct fix is to call put_device()
in a places where it is appropriate.