Unverified Commit 1b69bedf authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!12887 nfs: fix memory lead and nfs_server uaf

Merge Pull Request from: @ci-robot 
 
PR sync from: Li Lingfeng <lilingfeng3@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/PQRFPLP74OF3U3M6IAMNAS3DMUCBR3N2/ 
Li Lingfeng (1):
  nfs: fix memory leak in error path of nfs4_do_reclaim

Yang Erkun (1):
  nfs: maintain nfs_server in the reclaim process


-- 
2.31.1
 
https://gitee.com/openeuler/kernel/issues/IAUJJ4
https://gitee.com/openeuler/kernel/issues/IAOYZS 
 
Link:https://gitee.com/openeuler/kernel/pulls/12887

 

Reviewed-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
parents fb90de86 23da844c
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1875,6 +1875,12 @@ static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recov
				continue;
			if (!atomic_inc_not_zero(&sp->so_count))
				continue;
			if (!(server->super && nfs_sb_active(server->super))) {
				spin_unlock(&clp->cl_lock);
				rcu_read_unlock();
				nfs4_put_state_owner(sp);
				goto restart;
			}
			spin_unlock(&clp->cl_lock);
			rcu_read_unlock();

@@ -1883,10 +1889,13 @@ static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recov
				set_bit(ops->owner_flag_bit, &sp->so_flags);
				nfs4_put_state_owner(sp);
				status = nfs4_recovery_handle_error(clp, status);
				nfs4_free_state_owners(&freeme);
				nfs_sb_deactive(server->super);
				return (status != 0) ? status : -EAGAIN;
			}

			nfs4_put_state_owner(sp);
			nfs_sb_deactive(server->super);
			goto restart;
		}
		spin_unlock(&clp->cl_lock);