All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tyler Hicks <tyhicks@canonical.com>
To: "Geyslan Gregório Bem" <geyslan@gmail.com>
Cc: ecryptfs@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Pekka Enberg <penberg@kernel.org>
Subject: Re: [PATCH] ecryptfs: Fix explicit null dereference
Date: Thu, 14 Nov 2013 12:02:34 -0800	[thread overview]
Message-ID: <20131114200234.GB7693@boyd> (raw)
In-Reply-To: <CAGG-pURhr-YkQT5xLefK0=uN7vNx_EGJob=w54Z7VzcjYb=qiA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3039 bytes --]

On 2013-11-14 17:58:40, Geyslan Gregório Bem wrote:
> 2013/11/14 Tyler Hicks <tyhicks@canonical.com>:
> > On 2013-11-14 15:42:14, Geyslan G. Bem wrote:
> >> If the condition 'ecryptfs_file_to_private(file)' takes false branch
> >> lower_file is dereferenced when NULL.
> >>
> >> Caught by Coverity: CIDs 1128834 and 1128833.
> >>
> >> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
> >> ---
> >
> > Hello - Smatch picked up on this earlier in week and Dan analyzed the
> > situation here:
> >
> >   http://article.gmane.org/gmane.comp.file-systems.ecryptfs.general/441
> >
> > I agree with his assessment and proposed the following patch:
> >
> >   http://article.gmane.org/gmane.comp.file-systems.ecryptfs.general/442
> >
> > It makes Smatch happy and it should also make Coverity happy.
> >
> > Tyler
> 
> True. Disregard mine.
> 
> Thanks Tyler.

Thank you! Can I add your Reviewed-by: tag to that patch prior to
pushing it to my next branch?

Tyler

> 
> >
> >>  fs/ecryptfs/file.c | 12 ++++++++----
> >>  1 file changed, 8 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
> >> index 2229a74..1c0403a 100644
> >> --- a/fs/ecryptfs/file.c
> >> +++ b/fs/ecryptfs/file.c
> >> @@ -316,10 +316,12 @@ ecryptfs_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> >>       struct file *lower_file = NULL;
> >>       long rc = -ENOTTY;
> >>
> >> -     if (ecryptfs_file_to_private(file))
> >> -             lower_file = ecryptfs_file_to_lower(file);
> >> +     if (!ecryptfs_file_to_private(file))
> >> +             goto out;
> >> +     lower_file = ecryptfs_file_to_lower(file);
> >>       if (lower_file->f_op->unlocked_ioctl)
> >>               rc = lower_file->f_op->unlocked_ioctl(lower_file, cmd, arg);
> >> +out:
> >>       return rc;
> >>  }
> >>
> >> @@ -330,10 +332,12 @@ ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> >>       struct file *lower_file = NULL;
> >>       long rc = -ENOIOCTLCMD;
> >>
> >> -     if (ecryptfs_file_to_private(file))
> >> -             lower_file = ecryptfs_file_to_lower(file);
> >> +     if (!ecryptfs_file_to_private(file))
> >> +             goto out;
> >> +     lower_file = ecryptfs_file_to_lower(file);
> >>       if (lower_file->f_op && lower_file->f_op->compat_ioctl)
> >>               rc = lower_file->f_op->compat_ioctl(lower_file, cmd, arg);
> >> +out:
> >>       return rc;
> >>  }
> >>  #endif
> >> --
> >> 1.8.4.2
> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe ecryptfs" in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> 
> -- 
> Regards,
> 
> Geyslan G. Bem
> hackingbits.com
> --
> To unsubscribe from this list: send the line "unsubscribe ecryptfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-11-14 20:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14 18:42 [PATCH] ecryptfs: Fix explicit null dereference Geyslan G. Bem
2013-11-14 18:42 ` Geyslan G. Bem
2013-11-14 18:50 ` Pekka Enberg
2013-11-14 19:52 ` Tyler Hicks
2013-11-14 19:58   ` Geyslan Gregório Bem
2013-11-14 20:02     ` Tyler Hicks [this message]
2013-11-14 20:04       ` Geyslan Gregório Bem

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=20131114200234.GB7693@boyd \
    --to=tyhicks@canonical.com \
    --cc=dan.carpenter@oracle.com \
    --cc=ecryptfs@vger.kernel.org \
    --cc=geyslan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@kernel.org \
    /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.