linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Ben Shelton <ben.shelton@ni.com>
To: Brian Norris <computersforpeace@gmail.com>
Cc: taesoo@gatech.edu, Subodh Nijsure <snijsure@grid-net.com>,
	dedekind1@gmail.com, sanidhya@gatech.edu,
	adrian.hunter@intel.com, linux-kernel@vger.kernel.org,
	Terry Wilcox <terry.wilcox@ni.com>,
	linux-mtd@lists.infradead.org, blee@gatech.edu,
	Taesoo Kim <tsgatesv@gmail.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	Gratian Crisan <gratian.crisan@ni.com>,
	csong84@gatech.edu, changwoo@gatech.edu,
	Brad Mouring <brad.mouring@ni.com>
Subject: Re: [PATCH 1/1] UBIFS: fix incorrect unlocking handling
Date: Wed, 18 Mar 2015 09:54:25 -0500	[thread overview]
Message-ID: <20150318145425.GA20004@bshelton-desktop> (raw)
In-Reply-To: <20150318031858.GO32500@ld-irv-0074>

On 03/17, Brian Norris wrote:
> On Tue, Mar 17, 2015 at 10:09:26PM -0400, Taesoo Kim wrote:
> > When ubifs_init_security() fails, 'ui_mutex' is incorrectly
> > unlocked and incorrectly restores 'i_size'. There are four
> > such places that were introduce by the last commit.
> 
> "The last commit" is not very descriptive. Are you speaking of this
> commit?
> 
> commit d7f0b70d30ffb9bbe6b8a3e1035cf0b79965ef53
> Author: Subodh Nijsure <snijsure@grid-net.com>
> Date:   Fri Oct 31 13:50:30 2014 -0500
> 
>     UBIFS: Add security.* XATTR support for the UBIFS
> 
> CC'ing authors/reviewers.
> 
> Brian

This is indeed a bug, and this patch looks like the right fix.  Good catch!

Reviewed-by: Ben Shelton <ben.shelton@ni.com>

Ben

> 
> > Signed-off-by: Taesoo Kim <tsgatesv@gmail.com>
> > ---
> >  fs/ubifs/dir.c | 11 +++++++----
> >  1 file changed, 7 insertions(+), 4 deletions(-)
> > 
> > diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
> > index 0fa6c80..5b24bc4 100644
> > --- a/fs/ubifs/dir.c
> > +++ b/fs/ubifs/dir.c
> > @@ -272,7 +272,7 @@ static int ubifs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
> > 
> >  	err = ubifs_init_security(dir, inode, &dentry->d_name);
> >  	if (err)
> > -		goto out_cancel;
> > +		goto out_inode;
> > 
> >  	mutex_lock(&dir_ui->ui_mutex);
> >  	dir->i_size += sz_change;
> > @@ -292,6 +292,7 @@ out_cancel:
> >  	dir->i_size -= sz_change;
> >  	dir_ui->ui_size = dir->i_size;
> >  	mutex_unlock(&dir_ui->ui_mutex);
> > +out_inode:
> >  	make_bad_inode(inode);
> >  	iput(inode);
> >  out_budg:
> > @@ -732,7 +733,7 @@ static int ubifs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
> > 
> >  	err = ubifs_init_security(dir, inode, &dentry->d_name);
> >  	if (err)
> > -		goto out_cancel;
> > +		goto out_inode;
> > 
> >  	mutex_lock(&dir_ui->ui_mutex);
> >  	insert_inode_hash(inode);
> > @@ -757,6 +758,7 @@ out_cancel:
> >  	dir_ui->ui_size = dir->i_size;
> >  	drop_nlink(dir);
> >  	mutex_unlock(&dir_ui->ui_mutex);
> > +out_inode:
> >  	make_bad_inode(inode);
> >  	iput(inode);
> >  out_budg:
> > @@ -816,7 +818,7 @@ static int ubifs_mknod(struct inode *dir, struct dentry *dentry,
> > 
> >  	err = ubifs_init_security(dir, inode, &dentry->d_name);
> >  	if (err)
> > -		goto out_cancel;
> > +		goto out_inode;
> > 
> >  	mutex_lock(&dir_ui->ui_mutex);
> >  	dir->i_size += sz_change;
> > @@ -836,6 +838,7 @@ out_cancel:
> >  	dir->i_size -= sz_change;
> >  	dir_ui->ui_size = dir->i_size;
> >  	mutex_unlock(&dir_ui->ui_mutex);
> > +out_inode:
> >  	make_bad_inode(inode);
> >  	iput(inode);
> >  out_budg:
> > @@ -896,7 +899,7 @@ static int ubifs_symlink(struct inode *dir, struct dentry *dentry,
> > 
> >  	err = ubifs_init_security(dir, inode, &dentry->d_name);
> >  	if (err)
> > -		goto out_cancel;
> > +		goto out_inode;
> > 
> >  	mutex_lock(&dir_ui->ui_mutex);
> >  	dir->i_size += sz_change;
> > --
> > 2.3.3
> > 

  parent reply	other threads:[~2015-03-18 14:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18  2:09 [PATCH 1/1] UBIFS: fix incorrect unlocking handling Taesoo Kim
2015-03-18  3:18 ` Brian Norris
2015-03-18  3:37   ` Taesoo Kim
2015-03-18 14:54   ` Ben Shelton [this message]
2015-03-25  8:41 ` Artem Bityutskiy
2015-03-25  8:53 ` [PATCH v2] " Uwe Kleine-König
2015-03-25  9:15   ` Artem Bityutskiy

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=20150318145425.GA20004@bshelton-desktop \
    --to=ben.shelton@ni.com \
    --cc=adrian.hunter@intel.com \
    --cc=blee@gatech.edu \
    --cc=brad.mouring@ni.com \
    --cc=changwoo@gatech.edu \
    --cc=computersforpeace@gmail.com \
    --cc=csong84@gatech.edu \
    --cc=dedekind1@gmail.com \
    --cc=gratian.crisan@ni.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mkl@pengutronix.de \
    --cc=sanidhya@gatech.edu \
    --cc=snijsure@grid-net.com \
    --cc=taesoo@gatech.edu \
    --cc=terry.wilcox@ni.com \
    --cc=tsgatesv@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).