linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vasily Averin <vvs@virtuozzo.com>
To: Jeff Layton <jlayton@kernel.org>,
	"J. Bruce Fields" <bfields@redhat.com>,
	Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] nfsd: memory corruption in nfsd4_lock()
Date: Tue, 24 Mar 2020 01:12:33 +0300	[thread overview]
Message-ID: <e115cde6-315e-73ae-c89a-93eb5521e6c1@virtuozzo.com> (raw)
In-Reply-To: <7a3124cd2431eabe2495e0e8cd80068fe7261b1b.camel@kernel.org>

On 3/23/20 3:18 PM, Jeff Layton wrote:
> On Mon, 2020-03-23 at 10:55 +0300, Vasily Averin wrote:
>> New struct nfsd4_blocked_lock allocated in find_or_allocate_block()
>> does not initialised nbl_list and nbl_lru.
>> If conflock allocation fails rollback can call list_del_init()
>> access uninitialized fields and corrupt memory.
>>
>> Fixes: 76d348fadff5 ("nfsd: have nfsd4_lock use blocking locks for v4.1+ lock")
>> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
> 
> Good catch! Is there any reason not to just fix this by initializing the
> list_heads in find_or_allocate_block? That seems like it'd be a simpler
> fix.
> 

Rollback in nfsd4_lock() is not optimal, I've tried to improve it too,
However I agree such improvement is not a simplest fix
and it anyway does not make whole rollback perfect.

I think it's better to re-send small fix for the found problem,
and prepare separate patches for rollback improvements,

Thank you,
	Vasily Averin

  reply	other threads:[~2020-03-23 22:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-23  7:55 [PATCH] nfsd: memory corruption in nfsd4_lock() Vasily Averin
2020-03-23 12:18 ` Jeff Layton
2020-03-23 22:12   ` Vasily Averin [this message]
2020-03-23 13:50 ` Chuck Lever
2020-03-23 15:09   ` J. Bruce Fields
2020-03-26 15:55 ` Chuck Lever
2020-03-27  4:50   ` [PATCH v2] " Vasily Averin
2020-03-30 10:22     ` Jeff Layton
2020-03-30 14:52       ` Chuck Lever

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=e115cde6-315e-73ae-c89a-93eb5521e6c1@virtuozzo.com \
    --to=vvs@virtuozzo.com \
    --cc=bfields@redhat.com \
    --cc=chuck.lever@oracle.com \
    --cc=jlayton@kernel.org \
    --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).