Orangefs: do not finalize bufmap if it was never initialized.

Found by the infant Orangefs fuzzer...

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
This commit is contained in:
Martin Brandenburg 2015-12-14 15:26:38 -05:00
Родитель ce6c414e17
Коммит 90d26aa808
1 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -600,7 +600,8 @@ static int orangefs_devreq_release(struct inode *inode, struct file *file)
__func__); __func__);
mutex_lock(&devreq_mutex); mutex_lock(&devreq_mutex);
orangefs_bufmap_finalize(); if (get_bufmap_init())
orangefs_bufmap_finalize();
open_access_count--; open_access_count--;
@ -692,7 +693,13 @@ static long dispatch_ioctl_command(unsigned int command, unsigned long arg)
(struct ORANGEFS_dev_map_desc __user *) (struct ORANGEFS_dev_map_desc __user *)
arg, arg,
sizeof(struct ORANGEFS_dev_map_desc)); sizeof(struct ORANGEFS_dev_map_desc));
return ret ? -EIO : orangefs_bufmap_initialize(&user_desc); if (get_bufmap_init()) {
return -EINVAL;
} else {
return ret ?
-EIO :
orangefs_bufmap_initialize(&user_desc);
}
case ORANGEFS_DEV_REMOUNT_ALL: case ORANGEFS_DEV_REMOUNT_ALL:
gossip_debug(GOSSIP_DEV_DEBUG, gossip_debug(GOSSIP_DEV_DEBUG,
"%s: got ORANGEFS_DEV_REMOUNT_ALL\n", "%s: got ORANGEFS_DEV_REMOUNT_ALL\n",