Skip to contentSkip to conversation

Staging: ipack: dereferencing freed memory

PATCH In review Dan Carpenter 1 participant 1 message May 10, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Staging: ipack: dereferencing freed memory

We free "dev" then dereference it on the next line.

drivers/staging/ipack/bridges/tpci200.c +1 -1
index ab6ea0a..08cd851 100644
@@ -867,8 +867,8 @@ static int tpci200_slot_unregister(struct ipack_device *dev)
 		return -ERESTARTSYS;
 
 	ipack_device_unregister(dev);
-	kfree(dev);
 	tpci200->slots[dev->slot].dev = NULL;
+	kfree(dev);
 	mutex_unlock(&tpci200->mutex);
 
 	return 0;