Fix panic mounting unformatted zvol
On some older kernels, i.e. 2.6.18, zvol_ioctl_by_inode() may get passed a NULL file pointer if the user tries to mount a zvol without a filesystem on it. This change adds checks to prevent a null pointer dereference. Closes #73. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
parent
6ee71f5ce3
commit
b1c5821375
@ -1002,6 +1002,8 @@ static int
|
||||
zvol_ioctl_by_inode(struct inode *inode, struct file *file,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
if (file == NULL || inode == NULL)
|
||||
return -EINVAL;
|
||||
return zvol_ioctl(inode->i_bdev, file->f_mode, cmd, arg);
|
||||
}
|
||||
|
||||
@ -1010,6 +1012,8 @@ static long
|
||||
zvol_compat_ioctl_by_inode(struct file *file,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
if (file == NULL)
|
||||
return -EINVAL;
|
||||
return zvol_compat_ioctl(file->f_dentry->d_inode->i_bdev,
|
||||
file->f_mode, cmd, arg);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user