From: NeilBrown Date: Fri, 8 Jul 2005 00:59:14 +0000 (-0700) Subject: [PATCH] nfsd4: fix release_lockowner X-Git-Tag: v2.6.13-rc3~131 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0fa822e452084032b8495ca0d8e0199329847815;p=karo-tx-linux.git [PATCH] nfsd4: fix release_lockowner We oops in list_for_each_entry(), because release_stateowner frees something on the list we're traversing. Signed-off-by: Andy Adamson Signed-off-by: J. Bruce Fields Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 9f9db40b5666..e388c9070de4 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -3084,7 +3084,12 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp, struct nfsd4_release_lockowner * * of the lockowner state released; so don't release any until all * have been checked. */ status = nfs_ok; - list_for_each_entry(sop, &matches, so_perclient) { + while (!list_empty(&matches)) { + sop = list_entry(matches.next, struct nfs4_stateowner, + so_perclient); + /* unhash_stateowner deletes so_perclient only + * for openowners. */ + list_del(&sop->so_perclient); release_stateowner(sop); } out: