* [PATCH] SEGV in libsysfs/dlist.c
@ 2004-03-18 12:15 Hannes Reinecke
2004-03-24 23:15 ` Greg KH
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Hannes Reinecke @ 2004-03-18 12:15 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 346 bytes --]
Hi all, Greg,
libsysfs/dlist.c: _dlist_mark_move()
is missing checks for empty lists and may (and indeed, does) crash when
called with empty dlists.
Please apply.
Cheers,
Hannes
--
Dr. Hannes Reinecke hare@suse.de
SuSE Linux AG S390 & zSeries
Maxfeldstraße 5 +49 911 74053 688
90409 Nürnberg http://www.suse.de
[-- Attachment #2: libsysfs-dlist.patch --]
[-- Type: text/plain, Size: 503 bytes --]
===== dlist.c 1.3 vs edited =====
--- 1.3/libsysfs/dlist.c Wed Mar 10 18:12:14 2004
+++ edited/dlist.c Thu Mar 18 13:11:00 2004
@@ -74,14 +74,14 @@
{
if(direction)
{
- if( list->marker->next!=NULL)
+ if( list->marker && list->marker->next!=NULL)
list->marker=list->marker->next;
else
return(NULL);
}
else
{
- if( list->marker->prev!=NULL)
+ if( list->marker && list->marker->prev!=NULL)
list->marker=list->marker->prev;
else
return(NULL);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] SEGV in libsysfs/dlist.c
2004-03-18 12:15 [PATCH] SEGV in libsysfs/dlist.c Hannes Reinecke
@ 2004-03-24 23:15 ` Greg KH
2004-03-25 4:32 ` Ananth N Mavinakayanahalli
2004-03-31 22:58 ` Greg KH
2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2004-03-24 23:15 UTC (permalink / raw)
To: linux-hotplug
On Thu, Mar 18, 2004 at 01:15:35PM +0100, Hannes Reinecke wrote:
> Hi all, Greg,
>
> libsysfs/dlist.c: _dlist_mark_move()
>
> is missing checks for empty lists and may (and indeed, does) crash when
> called with empty dlists.
What code causes this to happen? udev? If so, where?
thanks,
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] SEGV in libsysfs/dlist.c
2004-03-18 12:15 [PATCH] SEGV in libsysfs/dlist.c Hannes Reinecke
2004-03-24 23:15 ` Greg KH
@ 2004-03-25 4:32 ` Ananth N Mavinakayanahalli
2004-03-31 22:58 ` Greg KH
2 siblings, 0 replies; 4+ messages in thread
From: Ananth N Mavinakayanahalli @ 2004-03-25 4:32 UTC (permalink / raw)
To: linux-hotplug
On Wed, Mar 24, 2004 at 03:15:06PM -0800, Greg KH wrote:
> On Thu, Mar 18, 2004 at 01:15:35PM +0100, Hannes Reinecke wrote:
> > Hi all, Greg,
> >
> > libsysfs/dlist.c: _dlist_mark_move()
> >
> > is missing checks for empty lists and may (and indeed, does) crash when
> > called with empty dlists.
>
> What code causes this to happen? udev? If so, where?
>
When a "get" function is called for obtaining a list, (of say, attirbutes)
it returns a NULL either because it was not able to retrieve the data from
sysfs (in which case the errno is set appropriately) or if the list is
NULL (because there are no elements exposed thru' sysfs), in which case
the errno is "0". If the list is not checked to be NULL, there
is a possibility of a de-referencing a NULL pointer.
Libsysfs takes care of this situation internally. With Dr. Hannes' patch,
we do not have to bother of segfaulting even if a NULL is passed.
Thanks,
Ananth
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] SEGV in libsysfs/dlist.c
2004-03-18 12:15 [PATCH] SEGV in libsysfs/dlist.c Hannes Reinecke
2004-03-24 23:15 ` Greg KH
2004-03-25 4:32 ` Ananth N Mavinakayanahalli
@ 2004-03-31 22:58 ` Greg KH
2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2004-03-31 22:58 UTC (permalink / raw)
To: linux-hotplug
On Thu, Mar 18, 2004 at 01:15:35PM +0100, Hannes Reinecke wrote:
> Hi all, Greg,
>
> libsysfs/dlist.c: _dlist_mark_move()
>
> is missing checks for empty lists and may (and indeed, does) crash when
> called with empty dlists.
>
> Please apply.
Applied, thanks.
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-03-31 22:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-18 12:15 [PATCH] SEGV in libsysfs/dlist.c Hannes Reinecke
2004-03-24 23:15 ` Greg KH
2004-03-25 4:32 ` Ananth N Mavinakayanahalli
2004-03-31 22:58 ` 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).