Skip to contentSkip to conversation

DAC960 fix for NULL dereference in open()

PATCH New Dave Olien 1 participant 1 message Aug 15, 2003 Block layer

lore
Share & tools
lore

Dave Olien

author
#0 lore raw

PATCH 1/1 DAC960 fix for NULL dereference in open()

This patch fixes a problem that's been hidden for a while. DAC960_open() will try to dereference a NULL pointer if an application opens (for example) /dev/rd/c0d12 when there has never been a logical device created for that file.

drivers/block/DAC960.c +1 -1
diff -ur linux-2.6.0-test3_mm2_original/drivers/block/DAC960.c linux-2.6.0-test3_mm2_DAC/drivers/block/DAC960.c
@@ -82,7 +82,7 @@
 	} else {
 		DAC960_V2_LogicalDeviceInfo_T *i =
 			p->V2.LogicalDeviceInformation[drive_nr];
-		if (i->LogicalDeviceState == DAC960_V2_LogicalDevice_Offline)
+		if (!i || i->LogicalDeviceState == DAC960_V2_LogicalDevice_Offline)
 			return -ENXIO;
 	}