From patchwork Mon Oct 31 01:18:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vitaliy Gusev X-Patchwork-Id: 9404891 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0026A6022E for ; Mon, 31 Oct 2016 01:18:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4CBA28E44 for ; Mon, 31 Oct 2016 01:18:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D958428E4B; Mon, 31 Oct 2016 01:18:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CD8528E44 for ; Mon, 31 Oct 2016 01:18:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933656AbcJaBSJ (ORCPT ); Sun, 30 Oct 2016 21:18:09 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:34127 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933455AbcJaBSG (ORCPT ); Sun, 30 Oct 2016 21:18:06 -0400 Received: by mail-qt0-f193.google.com with SMTP id l20so725183qta.1 for ; Sun, 30 Oct 2016 18:18:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:disposition-notification-to:from:date:cc :content-transfer-encoding:message-id:to; bh=8Hu+Maxrl8b/kWErMvbq4CQbZtJ+A2YP3SDIHF0xQGI=; b=HTAHo3kUGQtZ9Q0M4ynBDvL1pTglFLwSnlxCsWEsAdWaW7oi4+ZyhGlmo9nhkz1E0/ 6IDBA9iIg8ukFztVr/A1f3YOBpvqyi1LQwiEJjMMuqeuTXSiV50qGAY+thw0hg5ShG3i Mw/7wbCY4ckQUCW3wjOuPbWAFmFHsvPfBwS9yPdv5oNWfPQ4C4SCe9spCaBydmShfD2t +NW4sIiQBPV7XScKYaKtRbmgsZl6rk0/ojCOQ68Xa50eILeL5NyK7dnposJNqAuZ+pL3 kJhMwpdMYMSAFbcxe4WJ/KYtEUN1bYHrXtAFBj1jHX07ma9GAbqmxYov/QQkxNyfGvAs LA/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:mime-version:disposition-notification-to :from:date:cc:content-transfer-encoding:message-id:to; bh=8Hu+Maxrl8b/kWErMvbq4CQbZtJ+A2YP3SDIHF0xQGI=; b=XrcIAOzIKfPDOE9AeG3EHD2l1bawhmZw23Q9B5WxXZvxiTkCNbfzy2LFB5WJgcDLlf 9huovh2+vLzup991XbmwglfGrzX3+5HP9vipNDu432TEvupfhjj46TPMiM/+0mFwtW/J s7b8/G5PMuFPk8cCT5J+qTNyOntpklf6Jyz5Qq5CgCcHB/nUDYNb/qu3QNpwB5vJk0LB iOs+n4afqoG99uObqcbdDkQMLQnkN4+jh5vIgu8lCv7Y1wSJ30klt21z2+s3sH6KzLkP imhIcfpEPUkcN6cuK/oRbNEZry+0caxagN18/fMTZeKMt30GZ1IXaodZDJuiBVbo2Nfy uZtA== X-Gm-Message-State: ABUngvcyvFjhNJbyBgFoC+0UYoFaUiLc6CXUCMQO1/Vc16YzjcNSRR9wr/PaR5ZlC7+14g== X-Received: by 10.200.40.162 with SMTP id i31mr22724089qti.70.1477876685754; Sun, 30 Oct 2016 18:18:05 -0700 (PDT) Received: from [192.168.1.103] ([91.215.224.96]) by smtp.gmail.com with ESMTPSA id 126sm12194075qkl.12.2016.10.30.18.18.03 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 30 Oct 2016 18:18:04 -0700 (PDT) Subject: [PATCH] NFSv41: fix NULL dereference in nfs40_setup_sequence Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) From: Vitaliy Gusev Date: Mon, 31 Oct 2016 04:18:01 +0300 Cc: "linux-nfs@vger.kernel.org" , Anna Schumaker Message-Id: <0A7143CE-0592-444D-BA53-9CBB33E4373F@gmail.com> To: Trond Myklebust X-Mailer: Apple Mail (2.2104) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi. During some tests I’ve seen nfs-client crashes. It was just reading file via NFSv4.1 protocol. The panic message is below, fixing patch is attached. ——— "BUG: unable to handle kernel NULL pointer dereference at 0000000000000090 "IP: [] _raw_spin_lock+0xc/0x30 PGD 2a1c067 PUD 29e5067 PMD 0 Oops: 0002 [#1] SMP CPU: 1 PID: 3573 Comm: kworker/1:0 Not tainted 4.8.0-26-generic #28-Ubuntu Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/02/2015 Workqueue: rpciod rpc_async_schedule [sunrpc] task: ffffa017cb534740 task.stack: ffffa01782b44000 RIP: 0010:[] [] _raw_spin_lock+0xc/0x30N^ RSP: 0018:ffffa01782b47d48 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffffa017c735d208 RCX: ffffa01783816c00 RDX: 0000000000000001 RSI: ffffa017c735d1e0 RDI: 0000000000000090 RBP: ffffa01782b47d78 R08: ffffa017cec58a00 R09: 0000000000000000 R10: 0000000000000000 R11: 000000b4098ed036 R12: ffffa01783816c00 R13: 0000000000000000 R14: 0000000000000090 R15: ffffa017c735d1e0 FS: 0000000000000000(0000) GS:ffffa017cec40000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000090 CR3: 0000000002a0c000 CR4: 00000000001406e0 Stack: ffffffffc0836208 ffffa01783816c00 ffffffffc04c9070 ffffffffc04c9070 0000000000000000 ffffa01783816c40 ffffa01782b47d88 ffffffffc08362d0 ffffa01782b47d98 ffffffffc04c9089 ffffa01782b47e00 ffffffffc04cb6fd Call Trace: [] ? nfs40_setup_sequence+0x48/0xe0 [nfsv4] [] nfs4_open_confirm_prepare+0x30/0x40 [nfsv4] [] rpc_prepare_task+0x19/0x20 [sunrpc] [] __rpc_execute+0x8d/0x420 [sunrpc] [] rpc_async_schedule+0x12/0x20 [sunrpc] [] process_one_work+0x1fc/0x4b0 [] worker_thread+0x4b/0x500 [] kthread+0xd8/0xf0 [] ret_from_fork+0x1f/0x40 [] ? kthread_create_on_node+0x1e0/0x1e0 Code: 00 01 00 00 f0 0f c1 37 81 c6 00 01 00 00 40 84 f6 75 01 c3 55 48 89 e5 e8 e2 19 83 ff 5d c3 0f 1f 44 00 00 31 c0 ba 01 00 00 00 0f b1 17 85 c0 75 01 c3 55 89 c6 48 89 e5 e8 c0 01 83 ff 66 "RIP [] _raw_spin_lock+0xc/0x30 ——— From 1b5e4636c696a169f46b474de519f1d4d4f06277 Mon Sep 17 00:00:00 2001 From: Vitaliy Gusev Date: Mon, 31 Oct 2016 03:11:50 +0300 Subject: [PATCH] NFSv4.1: fix NULL dereference in nfs40_setup_sequence If OPEN4 reply has set OPEN4_RESULT_CONFIRM flag in rflags, nfs4.1 client calls pure NFSv4.0 function that shouldn't be used and this flags should be ignored. Signed-off-by: Vitaliy Gusev --- fs/nfs/nfs4proc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index a9dec32..054ce67 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -2023,6 +2023,9 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data) }; int status; + if (server->nfs_client->cl_mvops->minor_version != 0) + return 0; + nfs4_init_sequence(&data->c_arg.seq_args, &data->c_res.seq_res, 1); kref_get(&data->kref); data->rpc_done = 0;