linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] driver-core: Fix null reference in subsys_interface_unregister
@ 2012-01-14  2:06 jhbird.choi
  2012-01-16 18:19 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: jhbird.choi @ 2012-01-14  2:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Jonghwan Choi

From: Jonghwan Choi <jhbird.choi@samsung.com>

Check if the sif is not NULL before de-referencing it

Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
---
 drivers/base/bus.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 99dc592..4ddb38b 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -1193,13 +1193,15 @@ EXPORT_SYMBOL_GPL(subsys_interface_register);
 
 void subsys_interface_unregister(struct subsys_interface *sif)
 {
-	struct bus_type *subsys = sif->subsys;
+	struct bus_type *subsys;
 	struct subsys_dev_iter iter;
 	struct device *dev;
 
-	if (!sif)
+	if (!sif || !sif->subsys)
 		return;
 
+	subsys = sif->subsys;
+
 	mutex_lock(&subsys->p->mutex);
 	list_del_init(&sif->node);
 	if (sif->remove_dev) {
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] driver-core: Fix null reference in subsys_interface_unregister
  2012-01-14  2:06 [PATCH] driver-core: Fix null reference in subsys_interface_unregister jhbird.choi
@ 2012-01-16 18:19 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2012-01-16 18:19 UTC (permalink / raw)
  To: jhbird.choi; +Cc: linux-kernel

On Sat, Jan 14, 2012 at 11:06:03AM +0900, jhbird.choi@samsung.com wrote:
> From: Jonghwan Choi <jhbird.choi@samsung.com>
> 
> Check if the sif is not NULL before de-referencing it

Why would it be?  Have you hit this somehow?  If so, in what code?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-16 18:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-14  2:06 [PATCH] driver-core: Fix null reference in subsys_interface_unregister jhbird.choi
2012-01-16 18:19 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).