lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 27 Apr 2008 19:26:17 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Miklos Szeredi <miklos@...redi.hu>
Cc:	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [patch 3/5] fuse: fix race in llseek

On Fri, 25 Apr 2008 19:55:23 +0200 Miklos Szeredi <miklos@...redi.hu> wrote:

> +static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin)
> +{
> +	long long retval;

I switched this to have a type of loff_t.

> +	struct inode *inode = file->f_path.dentry->d_inode;
> +
> +	mutex_lock(&inode->i_mutex);
> +	switch (origin) {
> +	case SEEK_END:
> +		offset += i_size_read(inode);

As we hold i_mutex we could directly read inode->i_size here, save a few
cycles.

> +		break;
> +	case SEEK_CUR:
> +		offset += file->f_pos;
> +	}
> +	retval = -EINVAL;
> +	if (offset >= 0 && offset <= inode->i_sb->s_maxbytes) {
> +		if (offset != file->f_pos) {
> +			file->f_pos = offset;
> +			file->f_version = 0;
> +		}
> +		retval = offset;
> +	}
> +	mutex_unlock(&inode->i_mutex);
> +	return retval;
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ