linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: Simon Horman <horms@kernel.org>
Cc: Lorenzo Bianconi <lorenzo@kernel.org>,
	linux-nfs@vger.kernel.org, chuck.lever@oracle.com,
	jlayton@kernel.org, neilb@suse.de, netdev@vger.kernel.org
Subject: Re: [PATCH v8 3/3] NFSD: add rpc_status netlink support
Date: Thu, 14 Sep 2023 13:41:17 +0200	[thread overview]
Message-ID: <ZQLxXaJN7Qh9PCpn@lore-desk> (raw)
In-Reply-To: <20230912151340.GH401982@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 2245 bytes --]

[...]

> > +
> > +#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;
> 
> ...
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2023-09-14 11:42 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-11 12:49 [PATCH v8 0/3] add rpc_status netlink support for NFSD Lorenzo Bianconi
2023-09-11 12:49 ` [PATCH v8 1/3] Documentation: netlink: add a YAML spec for nfsd_server Lorenzo Bianconi
2023-09-11 17:20   ` Jeff Layton
2023-09-11 18:10   ` Chuck Lever
2023-09-14 10:46     ` Lorenzo Bianconi
2023-10-03 17:55   ` Jakub Kicinski
2023-10-03 18:40     ` Chuck Lever III
2023-10-03 19:02       ` Jakub Kicinski
2023-10-03 23:00         ` Chuck Lever III
2023-10-04  0:24           ` Jakub Kicinski
2023-09-11 12:49 ` [PATCH v8 2/3] NFSD: introduce netlink rpc_status stubs Lorenzo Bianconi
2023-09-11 19:35   ` Jeff Layton
2023-09-11 19:55   ` Chuck Lever
2023-09-14 11:20     ` Lorenzo Bianconi
2023-09-12 15:07   ` Simon Horman
2023-09-14 11:25     ` Lorenzo Bianconi
2023-09-11 12:49 ` [PATCH v8 3/3] NFSD: add rpc_status netlink support Lorenzo Bianconi
2023-09-11 19:43   ` Jeff Layton
2023-09-12 15:13   ` Simon Horman
2023-09-14 11:41     ` Lorenzo Bianconi [this message]
2023-10-03 18:03   ` Jakub Kicinski
2023-10-04 10:14     ` Lorenzo Bianconi
2023-10-04 13:27       ` Chuck Lever III
2023-10-04 14:04         ` Lorenzo Bianconi
2023-12-11 18:56   ` Jeff Layton
2023-12-12 12:07     ` Jeff Layton
2023-09-15 19:24 ` [PATCH v8 0/3] add rpc_status netlink support for NFSD Chuck Lever
2023-09-15 21:30   ` Lorenzo Bianconi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZQLxXaJN7Qh9PCpn@lore-desk \
    --to=lorenzo.bianconi@redhat.com \
    --cc=chuck.lever@oracle.com \
    --cc=horms@kernel.org \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=neilb@suse.de \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).