In the Linux kernel, the following vulnerability has been resolved: scsi: core: Fix possible memory leak if deviceadd() fails If deviceadd() returns error, the name allocated by devsetname() needs be freed. As the comment of deviceadd() says, putdevice() should be used to decrease the reference count in the error path. So fix this by calling putdevice(), then the name can be freed in kobjectcleanp().