Skip to contentSkip to conversation

Patch(2.5.51): __pnp_add_device dereferenced bad pointer

PATCH Adam J. Richter 1 participant 1 message Dec 15, 2002 Pnp support

lore
Share & tools
lore
#0 lore raw

__pnp_add_device dereferences a bad pointer when it traverses
the dev->id chain, because id->next is not initialized in certain cases, causing my Sony Picturebook pcg-c1vn to crash at boot. Here is a patch.

Signature · 4 lines
Adam J. Richter     __     ______________   575 Oroville Road
[email protected]     \ /                  Milpitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America
                         "Free Software For The Rest Of Us."
drivers/pnp/driver.c +1 -0
@@ -164,6 +164,7 @@
 		return -EINVAL;
 	if (!dev)
 		return -EINVAL;
+	id->next = NULL;
 	ptr = dev->id;
 	while (ptr && ptr->next)
 		ptr = ptr->next;