If copy_to_user failed in info ioctl, we always return -EFAULT so the
user will know there was an error.
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
static int events_info(struct hl_fpriv *hpriv, struct hl_info_args *args)
{
static int events_info(struct hl_fpriv *hpriv, struct hl_info_args *args)
{
u32 max_size = args->return_size;
u64 events_mask;
void __user *out = (void __user *) (uintptr_t) args->return_pointer;
u32 max_size = args->return_size;
u64 events_mask;
void __user *out = (void __user *) (uintptr_t) args->return_pointer;
hpriv->notifier_event.events_mask = 0;
mutex_unlock(&hpriv->notifier_event.lock);
hpriv->notifier_event.events_mask = 0;
mutex_unlock(&hpriv->notifier_event.lock);
- rc = copy_to_user(out, &events_mask, sizeof(u64));
- return rc;
+ return copy_to_user(out, &events_mask, sizeof(u64)) ? -EFAULT : 0;
}
static int dram_usage_info(struct hl_fpriv *hpriv, struct hl_info_args *args)
}
static int dram_usage_info(struct hl_fpriv *hpriv, struct hl_info_args *args)