linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: Vitaliy Gusev <gusev.vitaliy@nexenta.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] nfs4: Fix memory corruption due to not expected FS_LOCATIONS v3
Date: Tue, 22 Mar 2011 19:10:47 -0400	[thread overview]
Message-ID: <1300835447.22796.21.camel@lade.trondhjem.org> (raw)
In-Reply-To: <1300833541.17103.40.camel@vT510>

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.

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.


-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com


  reply	other threads:[~2011-03-22 23:11 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 [this message]
2011-03-22 23:18       ` Vitaliy Gusev

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=1300835447.22796.21.camel@lade.trondhjem.org \
    --to=trond.myklebust@netapp.com \
    --cc=gusev.vitaliy@nexenta.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).