[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZQLxXaJN7Qh9PCpn@lore-desk>
Date: Thu, 14 Sep 2023 13:41:17 +0200
From: Lorenzo Bianconi <lorenzo.bianconi@...hat.com>
To: Simon Horman <horms@...nel.org>
Cc: Lorenzo Bianconi <lorenzo@...nel.org>, linux-nfs@...r.kernel.org,
chuck.lever@...cle.com, jlayton@...nel.org, neilb@...e.de,
netdev@...r.kernel.org
Subject: Re: [PATCH v8 3/3] NFSD: add rpc_status netlink support
[...]
> > +
> > +#ifdef CONFIG_NFSD_V4
> > + if (rqstp->rq_vers == NFS4_VERSION &&
> > + rqstp->rq_proc == NFSPROC4_COMPOUND) {
> > + /* NFSv4 compund */
>
> nit: compound
ack, I will fix it.
>
> > + struct nfsd4_compoundargs *args;
> > + int j;
> > +
> > + args = rqstp->rq_argp;
> > + genl_rqstp.opcnt = args->opcnt;
> > + for (j = 0; j < genl_rqstp.opcnt; j++)
> > + genl_rqstp.opnum[j] =
> > + args->ops[j].opnum;
> > + }
> > +#endif /* CONFIG_NFSD_V4 */
> > +
> > + /*
> > + * Acquire rq_status_counter before reporting the rqst
> > + * fields to the user.
> > + */
> > + if (smp_load_acquire(&rqstp->rq_status_counter) !=
> > + status_counter)
> > + continue;
> > +
> > + ret = nfsd_genl_rpc_status_compose_msg(skb, cb,
> > + &genl_rqstp);
> > + if (ret)
> > + goto out;
> > + }
> > + }
> > +
> > + cb->args[0] = i;
> > + cb->args[1] = rqstp_index;
>
> I'm unsure if this is possible, but if the for loop above iterates zero
> times, or for all iterations (i < cb->args[0]), then rqstp_index will
> be used uninitialised here.
ack, thx for spotting it, I will fix it.
Regards,
Lorenzo
>
> Flagged by Smatch.
>
> > + ret = skb->len;
> > +out:
> > + rcu_read_unlock();
> > +
> > + return ret;
> > +}
>
> ...
>
> > diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
> > index 11c14faa6c67..d787bd38c053 100644
> > --- a/fs/nfsd/nfsd.h
> > +++ b/fs/nfsd/nfsd.h
> > @@ -62,6 +62,22 @@ struct readdir_cd {
> > __be32 err; /* 0, nfserr, or nfserr_eof */
> > };
> >
> > +/* Maximum number of operations per session compound */
> > +#define NFSD_MAX_OPS_PER_COMPOUND 50
> > +
> > +struct nfsd_genl_rqstp {
> > + struct sockaddr daddr;
> > + struct sockaddr saddr;
> > + unsigned long rq_flags;
> > + ktime_t rq_stime;
> > + __be32 rq_xid;
> > + u32 rq_vers;
> > + u32 rq_prog;
> > + u32 rq_proc;
> > + /* NFSv4 compund */
>
> nit: compound
>
> > + u32 opnum[NFSD_MAX_OPS_PER_COMPOUND];
> > + u16 opcnt;
> > +};
> >
> > extern struct svc_program nfsd_program;
> > extern const struct svc_version nfsd_version2, nfsd_version3, nfsd_version4;
>
> ...
>
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists