From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: viro@ZenIV.linux.org.uk, xfs <linux-xfs@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH] vfs: check ->get_link return value
Date: Tue, 2 Oct 2018 09:53:15 +1000 [thread overview]
Message-ID: <20181001235315.GM18567@dastard> (raw)
In-Reply-To: <20181001233336.GF5872@magnolia>
On Mon, Oct 01, 2018 at 04:33:36PM -0700, Darrick J. Wong wrote:
> On Tue, Oct 02, 2018 at 09:21:28AM +1000, Dave Chinner wrote:
> > On Mon, Oct 01, 2018 at 03:45:00PM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <darrick.wong@oracle.com>
> > >
> > > Teach callers of inode->i_op->get_link in the vfs code to check for a
> > > NULL return value and return an error status instead of blindly
> > > dereferencing the returned NULL pointer.
> > >
> > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > > ---
> > > fs/namei.c | 4 ++++
> > > 1 file changed, 4 insertions(+)
> > >
> > > diff --git a/fs/namei.c b/fs/namei.c
> > > index 0cab6494978c..0744ab981fa0 100644
> > > --- a/fs/namei.c
> > > +++ b/fs/namei.c
> > > @@ -4737,6 +4737,8 @@ int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen)
> > > if (IS_ERR(link))
> > > return PTR_ERR(link);
> > > }
> > > + if (!link)
> > > + return -EUCLEAN;
> >
> > If we are going to start returning this as a filesystem corruption
> > error from the VFS, can we please start with adding
> >
> > #define EFSCORRUPTED EUCLEAN
> >
> > into one of the global error definition headers? The code makes much
> > more sense when it uses EFSCORRUPTED....
>
> Ok, which header file? include/uapi/asm-generic/errno.h ?
Seems reasonable, because that's where EUCLEAN is defined.
> We'll finally be able to get rid of the redundant definitions in
> ext[24] too.
And filesystems like btrfs can be converted from EUCLEAN to
EFSCORRUPTED, too.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2018-10-02 6:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-01 22:45 [PATCH] vfs: check ->get_link return value Darrick J. Wong
2018-10-01 23:21 ` Dave Chinner
2018-10-01 23:33 ` Darrick J. Wong
2018-10-01 23:53 ` Dave Chinner [this message]
2018-10-01 23:52 ` Matthew Wilcox
2018-10-02 0:23 ` Darrick J. Wong
2018-10-02 1:54 ` Al Viro
2018-10-02 1:31 ` Al Viro
2018-10-02 2:07 ` Darrick J. Wong
2018-10-02 2:47 ` Al Viro
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=20181001235315.GM18567@dastard \
--to=david@fromorbit.com \
--cc=darrick.wong@oracle.com \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/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).