On 01/18/16 at 10:11am, Mimi Zohar wrote:
> diff --git a/fs/exec.c b/fs/exec.c
> index 211b81c..a5ae51e 100644
> --- a/fs/exec.c
> +++ b/fs/exec.c
> @@ -884,6 +884,21 @@ out:
>  }
>  EXPORT_SYMBOL_GPL(kernel_read_file);
>  
> +int kernel_read_file_from_fd(int fd, void **buf, loff_t *size, loff_t 
> max_size,
> +                          int policy_id)
> +{
> +     struct fd f = fdget(fd);
> +     int ret = -ENOEXEC;
> +
> +     if (!f.file)
> +             goto out;

It is no need to call the fdput, if f.file is NULL. It is better to
return it directly.

> +
> +     ret = kernel_read_file(f.file, buf, size, max_size, policy_id);
> +out:
> +     fdput(f);
> +     return ret;
> +}
> +

Thanks
Minfei

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

Reply via email to