Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1908466imm; Thu, 24 May 2018 02:44:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpbNukzlXaNYtXs4hu+7E0A1N4fF5oGW7cVTUO3uva9udmEXjgLqFskoefhwhFKchWgd9vY X-Received: by 2002:a17:902:8305:: with SMTP id bd5-v6mr6529714plb.13.1527155080922; Thu, 24 May 2018 02:44:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527155080; cv=none; d=google.com; s=arc-20160816; b=SgDmE2VKiNOvGLZenww/Usng8fh6lHhg7ubDezusXCx/2xFyobqiBzlwM7XDFftJ8A h+mPX6lvQegKZjCgv704gZFjWajI6uqG89KT5aASQo54k56ZjAodjqQwdkRkpEGNa+9M +y1ytFRanWQGsVzpa94G1n1QlLFrYAGWId4VAfsj+raNkdI2xWCl1Zt4o6Oa6Xv8pblb tmp/zIhDuh+C068nkAJR0Wmm5y4G9GRkhtW4YtLlpQfDIpvE9FSYiasDypXDwIeTRNuC R3YBNRs1KBnsL99hfkqwdViLGYbwziV5lJ0LinDJ1J+sD+6GgwabKMQ/lkUfz/9B1SMo u2pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=a84bwZeZ+5F3HOZcBcYLtXz6X4yJTptc2wF7mUti+u8=; b=TIWUiwRCqA/3VgtPnH/dnjdvtlWXcstsM+1m2aikl26dVBqFCZfqfOgoevszJmc8Rs /K/MxeNXg7mro6Pn8mZANYmRL9wRvQ4D8cKqzmv3X90GyjcJcWVKKOmdvjIAOR8ymGRM q1BUpHSnh6/XewdhFIRIkSEpYlEf+CLvV1HyqrZMQHmwI/VdA2N/xGqGZVdyuoGlnSi0 TMIY3cSdjNYlL5KtHN/Yzypa6PtprMsSeKjSxTsv3TChiX7HFc72BRZME9Oytq5/5UqW ErSjcyVuPn7pw0x+qKVsUCiTxPq0rinfouFS0PMyopjB4v+MVLl8NiXO8hRpasmgsaZ1 StCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZBMjO0Nb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e93-v6si11062258plk.386.2018.05.24.02.44.26; Thu, 24 May 2018 02:44:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZBMjO0Nb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966530AbeEXJnu (ORCPT + 99 others); Thu, 24 May 2018 05:43:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:55192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966245AbeEXJnp (ORCPT ); Thu, 24 May 2018 05:43:45 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4DEBA208B5; Thu, 24 May 2018 09:43:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155024; bh=RcYY93942XR7M0jnn51DzabR9CU/8gSJ229CxVdQJ5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZBMjO0Nb+gBTvL3Q9i/qDOT4XPslz1MbNeaZsrMMfTa7IhOEV54LGZBPfcUVZTl/I Lg3fhEByx+lgkjzrM6oH9DOGNgf022KeEZG78pCLZ8Q+1fPbs9ZhS9/5nuzkvoDxv7 onVwgXfXePbJIaBZjrPvWmahc8J/G94n1zIsMihQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vasily Averin , "J. Bruce Fields" , Ben Hutchings Subject: [PATCH 4.4 27/92] lockd: lost rollback of set_grace_period() in lockd_down_net() Date: Thu, 24 May 2018 11:38:04 +0200 Message-Id: <20180524093201.562199829@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093159.286472249@linuxfoundation.org> References: <20180524093159.286472249@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vasily Averin commit 3a2b19d1ee5633f76ae8a88da7bc039a5d1732aa upstream. Commit efda760fe95ea ("lockd: fix lockd shutdown race") is incorrect, it removes lockd_manager and disarm grace_period_end for init_net only. If nfsd was started from another net namespace lockd_up_net() calls set_grace_period() that adds lockd_manager into per-netns list and queues grace_period_end delayed work. These action should be reverted in lockd_down_net(). Otherwise it can lead to double list_add on after restart nfsd in netns, and to use-after-free if non-disarmed delayed work will be executed after netns destroy. Fixes: efda760fe95e ("lockd: fix lockd shutdown race") Cc: stable@vger.kernel.org Signed-off-by: Vasily Averin Signed-off-by: J. Bruce Fields Cc: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- fs/lockd/svc.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c @@ -271,6 +271,8 @@ static void lockd_down_net(struct svc_se if (ln->nlmsvc_users) { if (--ln->nlmsvc_users == 0) { nlm_shutdown_hosts_net(net); + cancel_delayed_work_sync(&ln->grace_period_end); + locks_end_grace(&ln->lockd_manager); svc_shutdown_net(serv, net); dprintk("lockd_down_net: per-net data destroyed; net=%p\n", net); }