SEGV in libsysfs/dlist.c
PATCH 1/1 SEGV in libsysfs/dlist.c
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
Signature · 4 lines
Dr. Hannes Reinecke [email protected] SuSE Linux AG S390 & zSeries Maxfeldstraße 5 +49 911 74053 688 90409 Nürnberg http://www.suse.de
===== dlist.c 1.3 vs edited =====
dlist.c renamed from libsysfs/dlist.c +2 -2
@@ -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 );
Quoted 6 lines · Hannes Reinecke
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_id70&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 10 lines · Greg KH
Quoted 6 lines · Hannes Reinecke
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_id70&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Greg KH
AppliedQuoted 8 lines · Hannes Reinecke
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_id70&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel