John Ogness | 2 Jul 2009 09:08

Re: Patch for mmap Bug in dazukofs 3.1.0-rc1

On 2009-07-01, Lino Sanfilippo <lino.sanfilippo <at> avira.com> wrote:
> This patch ensures that generic_file_readonly_mmap() is only called
> if the lower file actually supports mmap.
>
> If not the error code -ENODEV, which is used by the vfs to indicate
> that mmap is not supported, is returned.
>
> +static int dazukofs_mmap(struct file *file, struct vm_area_struct *vm) 
> +{
> +	struct file *lower_file = get_lower_file(file);
> +
> +	/* if lower fs does not support mmap, we dont call generic_mmap(), since
> +	 * this would result in calling lower readpage(), which might not be defined
> +	 * by lower fs, since mmap is not supported */
> +	if (!lower_file->f_op || !lower_file->f_op->mmap)
> +		return -ENODEV; 
> +	return generic_file_mmap(file, vm);
> +}

Shouldn't it be:

    if (!lower_file->f_op || !lower_file->f_op->mmap)
            return -ENODEV;
    return generic_file_readonly_mmap(file, vm);

instead?

John Ogness

--

-- 
Dazuko Maintainer

Gmane