From: Vitaliy Gusev <gusev.vitaliy@nexenta.com>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] nfs4: Fix memory corruption due to not expected FS_LOCATIONS v3
Date: Wed, 23 Mar 2011 02:18:49 +0300 [thread overview]
Message-ID: <1300835929.17103.70.camel@vT510> (raw)
In-Reply-To: <1300835447.22796.21.camel@lade.trondhjem.org>
On Tue, 2011-03-22 at 19:10 -0400, Trond Myklebust wrote:
> On Wed, 2011-03-23 at 01:39 +0300, Vitaliy Gusev wrote:
> > On Tue, 2011-03-22 at 17:46 -0400, Trond Myklebust wrote:
> >
> > > Why are you limiting this to fs_locations?
> >
> > Sorry, I haven't seen any other attribute that can cause memory
> > corruption.
>
> decode_attr_filehandle() will certainly cause an Oops if someone inserts one.
Hmm, Thanks! But it seems that here plain check on NULL is enough...
>
> There may be more occurrences in the future if/when we need to add
> support for more attributes.
>
> > > As I believe I said earlier,
> > > any attribute that we didn't explicitly request is an error and can
> > > cause corruption in the client.
> >
> > There are checks on each decode attr function. For instance,
> > decode_attr_filehandle:
> >
> > if (unlikely(bitmap[0] & (FATTR4_WORD0_FILEHANDLE - 1U)))
> > return -EIO;
> >
> > So any non handled attribute raise EIO error.
>
> If we're going to do this, then I suggest we add an 'expected bitmask'
> argument to 'decode_attr_bitmap()'. If the server sets any bit that is
> not part of this expected bitmask, then we can immediately return an EIO
> without having to decode any further.
>
> That will allow us to get rid of the 'if (unlikely(bitmap[] & ....)'
> tests altogether.
You are right. I'll do as you said.
--
Thanks,
Vitaliy Gusev
prev parent reply other threads:[~2011-03-22 23:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-22 21:36 [PATCH] nfs4: Fix memory corruption due to not expected FS_LOCATIONS v3 Vitaliy Gusev
2011-03-22 21:46 ` Trond Myklebust
2011-03-22 22:39 ` Vitaliy Gusev
2011-03-22 23:10 ` Trond Myklebust
2011-03-22 23:18 ` Vitaliy Gusev [this message]
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=1300835929.17103.70.camel@vT510 \
--to=gusev.vitaliy@nexenta.com \
--cc=Trond.Myklebust@netapp.com \
--cc=linux-nfs@vger.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 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).