uio: fix incorrect memory leak cleanup
authorSuman Anna <s-anna@ti.com>
Tue, 9 May 2017 23:58:24 +0000 (18:58 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Apr 2018 17:47:59 +0000 (19:47 +0200)
commit4cc339e66447d8bee92a7f8ecbc23d8aa517fba1
tree63a79137781f8cb01b1547619f59ef72015ee1e0
parentc4eca7ee0ed886529c6446bad7fb5ead5e8129d6
uio: fix incorrect memory leak cleanup

[ Upstream commit 0d83539092ddb1ab79b4d65bccb866bf07ea2ccd ]

Commit 75f0aef6220d ("uio: fix memory leak") has fixed up some
memory leaks during the failure paths of the addition of uio
attributes, but still is not correct entirely. A kobject_uevent()
failure still needs a kobject_put() and the kobject container
structure allocation failure before the kobject_init() doesn't
need a kobject_put(). Fix this properly.

Fixes: 75f0aef6220d ("uio: fix memory leak")
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/uio/uio.c