powerpc/powernv : Drop reference added by kset_find_obj()
authorMukesh Ojha <mukesh02@linux.vnet.ibm.com>
Mon, 22 Aug 2016 06:47:44 +0000 (12:17 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 24 Sep 2016 08:07:35 +0000 (10:07 +0200)
commit76ddde66addcb24ee2e0a3f910dc533d5ee61a8f
tree6562271cff952b97fe3cb5e06d9b35b4dcf72512
parent53545131ecea3a41f4b1b4f6d8b04c8a2a78ac35
powerpc/powernv : Drop reference added by kset_find_obj()

commit a9cbf0b2195b695cbeeeecaa4e2770948c212e9a upstream.

In a situation, where Linux kernel gets notified about duplicate error log
from OPAL, it is been observed that kernel fails to remove sysfs entries
(/sys/firmware/opal/elog/0xXXXXXXXX) of such error logs. This is because,
we currently search the error log/dump kobject in the kset list via
'kset_find_obj()' routine. Which eventually increment the reference count
by one, once it founds the kobject.

So, unless we decrement the reference count by one after it found the kobject,
we would not be able to release the kobject properly later.

This patch adds the 'kobject_put()' which was missing earlier.

Signed-off-by: Mukesh Ojha <mukesh02@linux.vnet.ibm.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/platforms/powernv/opal-dump.c
arch/powerpc/platforms/powernv/opal-elog.c