* Re: Re: [PATCH] driver-core: Fix null reference in subsys_interface_unregister
@ 2012-01-17 0:35 최종환
2012-01-17 0:59 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: 최종환 @ 2012-01-17 0:35 UTC (permalink / raw)
To: Greg KH, 최종환
Cc: linux-kernel@vger.kernel.org, 김국진
[-- 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¥
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: Re: [PATCH] driver-core: Fix null reference in subsys_interface_unregister
2012-01-17 0:35 Re: [PATCH] driver-core: Fix null reference in subsys_interface_unregister 최종환
@ 2012-01-17 0:59 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2012-01-17 0:59 UTC (permalink / raw)
To: 최종환
Cc: linux-kernel@vger.kernel.org, 김국진
On Tue, Jan 17, 2012 at 12:35:35AM +0000, 최종환 wrote:
> 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.
Yes, you are right, I missed the previous usage. I'll queue this up for
3.4.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-17 1:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-17 0:35 Re: [PATCH] driver-core: Fix null reference in subsys_interface_unregister 최종환
2012-01-17 0:59 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.