@@ -4699,7 +4699,7 @@ static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry,
46994699 return err ;
47004700}
47014701
4702- static int _nfs4_proc_readdir (struct dentry * dentry , struct rpc_cred * cred ,
4702+ static int _nfs4_proc_readdir (struct dentry * dentry , const struct cred * cred ,
47034703 u64 cookie , struct page * * pages , unsigned int count , bool plus )
47044704{
47054705 struct inode * dir = d_inode (dentry );
@@ -4712,17 +4712,23 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
47124712 .plus = plus ,
47134713 };
47144714 struct nfs4_readdir_res res ;
4715+ struct auth_cred acred = {
4716+ .cred = cred ,
4717+ };
47154718 struct rpc_message msg = {
47164719 .rpc_proc = & nfs4_procedures [NFSPROC4_CLNT_READDIR ],
47174720 .rpc_argp = & args ,
47184721 .rpc_resp = & res ,
4719- .rpc_cred = cred ,
4722+ .rpc_cred = rpc_lookup_generic_cred (& acred ,
4723+ 0 , GFP_NOFS ),
47204724 };
47214725 int status ;
47224726
47234727 dprintk ("%s: dentry = %pd2, cookie = %Lu\n" , __func__ ,
47244728 dentry ,
47254729 (unsigned long long )cookie );
4730+ if (!msg .rpc_cred )
4731+ return - ENOMEM ;
47264732 nfs4_setup_readdir (cookie , NFS_I (dir )-> cookieverf , dentry , & args );
47274733 res .pgbase = args .pgbase ;
47284734 status = nfs4_call_sync (NFS_SERVER (dir )-> client , NFS_SERVER (dir ), & msg , & args .seq_args , & res .seq_res , 0 );
@@ -4733,11 +4739,12 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
47334739
47344740 nfs_invalidate_atime (dir );
47354741
4742+ put_rpccred (msg .rpc_cred );
47364743 dprintk ("%s: returns %d\n" , __func__ , status );
47374744 return status ;
47384745}
47394746
4740- static int nfs4_proc_readdir (struct dentry * dentry , struct rpc_cred * cred ,
4747+ static int nfs4_proc_readdir (struct dentry * dentry , const struct cred * cred ,
47414748 u64 cookie , struct page * * pages , unsigned int count , bool plus )
47424749{
47434750 struct nfs4_exception exception = { };
0 commit comments