Re: [PATCH] locks: only validate the lock vs. f_mode in F_SETLK codepaths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 09, 2014 at 12:21:29PM -0400, Jeff Layton wrote:

 > -	/* Ensure that fl->fl_filp has compatible f_mode */
 > -	switch (l->l_type) {
 > -	case F_RDLCK:
 > -		if (!(filp->f_mode & FMODE_READ))
 > -			return -EBADF;
 > -		break;
 > -	case F_WRLCK:
 > -		if (!(filp->f_mode & FMODE_WRITE))
 > -			return -EBADF;
 > -		break;
 > -	}


 > +check_fmode_for_setlk(struct file_lock *fl)
 > +{
 > +	switch (fl->fl_type) {
 > +	case F_RDLCK:
 > +		if (!(fl->fl_file->f_mode & FMODE_READ))
 > +			return -EBADF;
 > +	case F_WRLCK:
 > +		if (!(fl->fl_file->f_mode & FMODE_WRITE))
 > +			return -EBADF;
 > +	}
 > +	return 0;
 > +}

Why are we now checking FMODE_WRITE for the RDLCK case ?
Or was losing the break; unintentional ?

	Dave

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux