All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: Jeff Layton <jlayton@poochiereds.net>
Cc: linux-fsdevel@vger.kernel.org, Reuben Farrelly <reuben@reub.net>,
	bfields@fieldses.org, swhiteho@redhat.com, ssorce@redhat.com
Subject: Re: [PATCH] locks: only validate the lock vs. f_mode in F_SETLK codepaths
Date: Fri, 9 May 2014 14:07:44 -0400	[thread overview]
Message-ID: <20140509180744.GA9930@redhat.com> (raw)
In-Reply-To: <1399652489-5217-1-git-send-email-jlayton@poochiereds.net>

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


  reply	other threads:[~2014-05-09 18:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-09 16:21 [PATCH] locks: only validate the lock vs. f_mode in F_SETLK codepaths Jeff Layton
2014-05-09 18:07 ` Dave Jones [this message]
2014-05-09 18:15   ` Jeff Layton
2014-05-09 23:59     ` Reuben Farrelly
2014-05-12 16:17 ` [PATCH v2] " Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140509180744.GA9930@redhat.com \
    --to=davej@redhat.com \
    --cc=bfields@fieldses.org \
    --cc=jlayton@poochiereds.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=reuben@reub.net \
    --cc=ssorce@redhat.com \
    --cc=swhiteho@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.