mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: 최종환 <jhbird.choi@samsung.com>
To: "Greg KH" <gregkh@suse.de>, 최종환 <jhbird.choi@samsung.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	김국진 <kgene.kim@samsung.com>
Subject: Re: Re: [PATCH] driver-core: Fix null reference in subsys_interface_unregister
Date: Tue, 17 Jan 2012 00:35:36 +0000 (GMT)	[thread overview]
Message-ID: <15905052.41411326760535818.JavaMail.weblogic@epv6ml08> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 1405 bytes --]

Greg KH wrote:

>On Sat, Jan 14, 2012 at 11:06:03AM +0900, jhbird.choi@samsung.com wrote:
>> From: Jonghwan Choi 
> >
> >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


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;   // -> Sif is already used, that means sif is not null
+       struct bus_type *subsys;
        struct subsys_dev_iter iter;
        struct device *dev;

-       if (!sif)  // -> Check whether sif is null 
+       if (!sif || !sif->subsys)
                return;

+       subsys = sif->subsys;
+
        mutex_lock(&subsys->p->mutex);
        list_del_init(&sif->node);
        if (sif->remove_dev) {
-- 

sif is already used, but  null pointer check for sif later.
so i think that sif should be checked before use it.


Sorry about that, since my e-mail client has a problem,
 I couldn't send that to mailing list. I will send it to mailing list.
 Thanks.ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

             reply	other threads:[~2012-01-17  0:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-17  0:35 최종환 [this message]
2012-01-17  0:59 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15905052.41411326760535818.JavaMail.weblogic@epv6ml08 \
    --to=jhbird.choi@samsung.com \
    --cc=gregkh@suse.de \
    --cc=kgene.kim@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome