linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: f2fs crypto: add symlink encryption
Date: Tue, 12 May 2015 21:36:21 +0300	[thread overview]
Message-ID: <20150512183621.GP16501@mwanda> (raw)
In-Reply-To: <20150512181716.GA27003@jaegeuk-mac02.mot.com>

On Tue, May 12, 2015 at 11:17:16AM -0700, Jaegeuk Kim wrote:
> > For example, shouldn't we release f2fs_lock_op(sbi) when f2fs_add_link()
> > fails earlier?
> 
> The pair of f2fs_lock_op and f2fs_unlock_op here is used to keep FS
> consistency.
> And, the handle_failed_inode() should be covered by f2fs_lock_op, so there is
> no reason to do unlock and lock redundantly to handle the error case.

Yes, you are right, but the code is still not correct unfortunately.

fs/f2fs/namei.c
   424  
   425          f2fs_lock_op(sbi);
   426          err = f2fs_add_link(dentry, inode);
   427          if (err)
   428                  goto out;
                        ^^^^^^^^
Holding the lock.  This is correct as you say.

   429          f2fs_unlock_op(sbi);
   430  
   431          if (f2fs_encrypted_inode(dir)) {
   432                  struct qstr istr = QSTR_INIT(symname, len);
   433  
   434                  err = f2fs_inherit_context(dir, inode, NULL);
   435                  if (err)
   436                          goto out;
                                ^^^^^^^^
Not holding the lock.  This is a double unlock bug.

   437  
   438                  err = f2fs_setup_fname_crypto(inode);
   439                  if (err)
   440                          goto out;

regards,
dan carpenter


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y

  reply	other threads:[~2015-05-12 18:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12 12:09 f2fs crypto: add symlink encryption Dan Carpenter
2015-05-12 18:17 ` Jaegeuk Kim
2015-05-12 18:36   ` Dan Carpenter [this message]
2015-05-12 18:39     ` Jaegeuk Kim

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=20150512183621.GP16501@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /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).