Commit fc132fde authored by Dave Olien's avatar Dave Olien Committed by Doug Ledford

[PATCH] DAC960 fix for NULL dereference in open()

This 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.
parent 1d0cd283
...@@ -82,7 +82,7 @@ static int DAC960_open(struct inode *inode, struct file *file) ...@@ -82,7 +82,7 @@ static int DAC960_open(struct inode *inode, struct file *file)
} else { } else {
DAC960_V2_LogicalDeviceInfo_T *i = DAC960_V2_LogicalDeviceInfo_T *i =
p->V2.LogicalDeviceInformation[drive_nr]; p->V2.LogicalDeviceInformation[drive_nr];
if (i->LogicalDeviceState == DAC960_V2_LogicalDevice_Offline) if (!i || i->LogicalDeviceState == DAC960_V2_LogicalDevice_Offline)
return -ENXIO; return -ENXIO;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment