summaryrefslogtreecommitdiffstats
path: root/module/zfs/zvol.c
diff options
context:
space:
mode:
authorNed Bass <[email protected]>2010-10-29 12:13:52 -0700
committerBrian Behlendorf <[email protected]>2010-10-29 14:46:33 -0700
commitb1c58213751141f28793e723017d4064893d819a (patch)
treecf9271ebc4e503930915ec22aef373b370d86a60 /module/zfs/zvol.c
parent6ee71f5ce39885969f986f3092fed00f41667963 (diff)
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 <[email protected]>
Diffstat (limited to 'module/zfs/zvol.c')
-rw-r--r--module/zfs/zvol.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c
index 6e9294292..b2a08fb43 100644
--- a/module/zfs/zvol.c
+++ b/module/zfs/zvol.c
@@ -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);
}