Skip to contentSkip to conversation

Patch "nfsd: Detect unhashed stids in nfsd4_verify_open_stid()" has been added to the 4.15-stable tree

PATCH [email protected] 1 participant 1 message Feb 14, 2018

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

nfsd: Detect unhashed stids in nfsd4_verify_open_stid()

to the 4.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
nfsd-detect-unhashed-stids-in-nfsd4_verify_open_stid.patch
and it can be found in the queue-4.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 4f1764172a0aa7395d12b96cae640ca1438c5085 Mon Sep 17 00:00:00 2001

From: Trond Myklebust <[email protected]>
Date: Fri, 12 Jan 2018 17:42:30 -0500
Subject: nfsd: Detect unhashed stids in nfsd4_verify_open_stid()

From: Trond Myklebust <[email protected]>

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().

Fixes 659aefb68eca "nfsd: Ensure we don't recognise lock stateids..."
---
 fs/nfsd/nfs4state.c |    1 +
 1 file changed, 1 insertion(+)
fs/nfsd/nfs4state.c +1 -0
@@ -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;

Patches currently in stable-queue which might be from [email protected] are

queue-4.15/nfs-pnfs-fix-nfs_direct_req-ref-leak-when-i-o-falls-back-to-the-mds.patch queue-4.15/nfsd-detect-unhashed-stids-in-nfsd4_verify_open_stid.patch queue-4.15/nfs-fix-nfsstat-breakage-due-to-lookupp.patch queue-4.15/nfs-add-a-cond_resched-to-nfs_commit_release_pages.patch queue-4.15/nfs41-do-not-return-enomem-on-layoutunavailable.patch queue-4.15/nfs-commit-direct-writes-even-if-they-fail-partially.patch queue-4.15/nfs-fix-a-race-between-mmap-and-o_direct.patch