Received: by 10.223.185.116 with SMTP id b49csp85941wrg; Thu, 15 Feb 2018 17:08:49 -0800 (PST) X-Google-Smtp-Source: AH8x224FDCbpde8c3/YRkCWfV9EafmqLJZBsEGLqssajaTY9qABrVIYg0YY8zvIZqn9ozGdPX/1Z X-Received: by 2002:a17:902:34f:: with SMTP id 73-v6mr4104749pld.55.1518743329845; Thu, 15 Feb 2018 17:08:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518743329; cv=none; d=google.com; s=arc-20160816; b=kpflR293/zB1n0E8YMSp4HRRH9zHcIiwvaCOYdVSKUwQ4dXr9e1ZKc8+MzJbS4aIpZ +WnlESk8FcVtKfKTXrvnjWS6i/WzkG7Z2Otwjoihiq11x/K3JPPhwQWcZLpgYlC35Iwo pDfw33qOpUvru2Plm3J67fGNsZgJfDaKA69yL7PMVCAotURwZtWjkd03W807T9BUsJvX uJDhTVLAU3WWWYGlZw1ihszcNvcAK9hukhgljzZuDiSZMHldFzG4muT0HNGxUzGIiYJc 7TrrNSMjw0lxd54Wi4iFhpbs5BZFzo107qrcnTySlmakGxfIFFEG468zCdb1ipHPuvQV p3NQ== 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 :arc-authentication-results; bh=nhYThPe7N9FAZqZ9YSuPminrMQt6kWmLSt4zxpY0cow=; b=aWJv0X/ulE+ElbS7TcG/2ZiBZNmTvEpotGgygf5A2S16AHbMbV+P0Z1jI3JMR0obRI X5AGiEnkWvWI655QzKZmIGrzWpQGWxnDN+3Ki86LSvrhhPuhut9YbEsuhoao6gQDYQtQ 3oJgaEJJ8b32LwnVNyHOas1PdqXF2EJM7YQdvTJvvULNcSRxVjff/AjiraKDgcfTdg9i M0pHI50iVsRPeSYohwsfAy/aPdO9byHNzqDG/JZQh9mL7f/ayOIXC+AcXZIKl1gznzl6 ybX7U0pavKE555C9p03rmUyrqtR8Ax1wc7oq9r6JMlgYKkXy41ghutAnqA6FlQYkDZg4 DX/Q== ARC-Authentication-Results: i=1; mx.google.com; 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 f62-v6si2215599plb.297.2018.02.15.17.08.35; Thu, 15 Feb 2018 17:08:49 -0800 (PST) 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; 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 S1033986AbeBOPnR (ORCPT + 99 others); Thu, 15 Feb 2018 10:43:17 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:33908 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033257AbeBOPnP (ORCPT ); Thu, 15 Feb 2018 10:43:15 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BB3241150; Thu, 15 Feb 2018 15:43:14 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Checuk Lever , "J. Bruce Fields" Subject: [PATCH 4.15 103/202] nfsd: Detect unhashed stids in nfsd4_verify_open_stid() Date: Thu, 15 Feb 2018 16:16:43 +0100 Message-Id: <20180215151718.671374934@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 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.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Trond Myklebust commit 4f1764172a0aa7395d12b96cae640ca1438c5085 upstream. The state of the stid is guaranteed by 2 locks: - The nfs4_client 'cl_lock' spinlock - The nfs4_ol_stateid 'st_mutex' mutex so it is quite possible for the stid to be unhashed after lookup, but before calling nfsd4_lock_ol_stateid(). So we do need to check for a zero value for 'sc_type' in nfsd4_verify_open_stid(). Signed-off-by: Trond Myklebust Tested-by: Checuk Lever Fixes: 659aefb68eca "nfsd: Ensure we don't recognise lock stateids..." Signed-off-by: J. Bruce Fields Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfs4state.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -3590,6 +3590,7 @@ nfsd4_verify_open_stid(struct nfs4_stid switch (s->sc_type) { default: break; + case 0: case NFS4_CLOSED_STID: case NFS4_CLOSED_DELEG_STID: ret = nfserr_bad_stateid;