Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 860bda29 authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

sunrpc: mark all struct svc_procinfo instances as const



struct svc_procinfo contains function pointers, and marking it as
constant avoids it being able to be used as an attach vector for
code injections.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 7fd38af9
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -507,7 +507,7 @@ struct nlm_void { int dummy; };
#define	No	(1+1024/4)				/* netobj */
#define	No	(1+1024/4)				/* netobj */
#define	St	1					/* status */
#define	St	1					/* status */
#define	Rg	4					/* range (offset + length) */
#define	Rg	4					/* range (offset + length) */
struct svc_procedure		nlmsvc_procedures4[] = {
const struct svc_procedure nlmsvc_procedures4[] = {
  PROC(null,		void,		void,		void,	void, 1),
  PROC(null,		void,		void,		void,	void, 1),
  PROC(test,		testargs,	testres,	args,	res, Ck+St+2+No+Rg),
  PROC(test,		testargs,	testres,	args,	res, Ck+St+2+No+Rg),
  PROC(lock,		lockargs,	res,		args,	res, Ck+St),
  PROC(lock,		lockargs,	res,		args,	res, Ck+St),
+1 −1
Original line number Original line Diff line number Diff line
@@ -551,7 +551,7 @@ struct nlm_void { int dummy; };
#define	No	(1+1024/4)			/* Net Obj */
#define	No	(1+1024/4)			/* Net Obj */
#define	Rg	2				/* range - offset + size */
#define	Rg	2				/* range - offset + size */


struct svc_procedure		nlmsvc_procedures[] = {
const struct svc_procedure nlmsvc_procedures[] = {
  PROC(null,		void,		void,		void,	void, 1),
  PROC(null,		void,		void,		void,	void, 1),
  PROC(test,		testargs,	testres,	args,	res, Ck+St+2+No+Rg),
  PROC(test,		testargs,	testres,	args,	res, Ck+St+2+No+Rg),
  PROC(lock,		lockargs,	res,		args,	res, Ck+St),
  PROC(lock,		lockargs,	res,		args,	res, Ck+St),
+1 −1
Original line number Original line Diff line number Diff line
@@ -995,7 +995,7 @@ static struct callback_op callback_ops[] = {
/*
/*
 * Define NFS4 callback procedures
 * Define NFS4 callback procedures
 */
 */
static struct svc_procedure nfs4_callback_procedures1[] = {
static const struct svc_procedure nfs4_callback_procedures1[] = {
	[CB_NULL] = {
	[CB_NULL] = {
		.pc_func = nfs4_callback_null,
		.pc_func = nfs4_callback_null,
		.pc_decode = nfs4_decode_void,
		.pc_decode = nfs4_decode_void,
+1 −1
Original line number Original line Diff line number Diff line
@@ -370,7 +370,7 @@ struct nfsd3_voidargs { int dummy; };
#define pAT (1+AT)	/* post attributes - conditional */
#define pAT (1+AT)	/* post attributes - conditional */
#define ACL (1+NFS_ACL_MAX_ENTRIES*3)  /* Access Control List */
#define ACL (1+NFS_ACL_MAX_ENTRIES*3)  /* Access Control List */


static struct svc_procedure		nfsd_acl_procedures2[] = {
static const struct svc_procedure nfsd_acl_procedures2[] = {
  PROC(null,	void,		void,		void,	  RC_NOCACHE, ST),
  PROC(null,	void,		void,		void,	  RC_NOCACHE, ST),
  PROC(getacl,	getacl,		getacl,		getacl,	  RC_NOCACHE, ST+1+2*(1+ACL)),
  PROC(getacl,	getacl,		getacl,		getacl,	  RC_NOCACHE, ST+1+2*(1+ACL)),
  PROC(setacl,	setacl,		attrstat,	attrstat, RC_NOCACHE, ST+AT),
  PROC(setacl,	setacl,		attrstat,	attrstat, RC_NOCACHE, ST+AT),
+1 −1
Original line number Original line Diff line number Diff line
@@ -257,7 +257,7 @@ struct nfsd3_voidargs { int dummy; };
#define pAT (1+AT)	/* post attributes - conditional */
#define pAT (1+AT)	/* post attributes - conditional */
#define ACL (1+NFS_ACL_MAX_ENTRIES*3)  /* Access Control List */
#define ACL (1+NFS_ACL_MAX_ENTRIES*3)  /* Access Control List */


static struct svc_procedure		nfsd_acl_procedures3[] = {
static const struct svc_procedure nfsd_acl_procedures3[] = {
  PROC(null,	void,		void,		void,	  RC_NOCACHE, ST),
  PROC(null,	void,		void,		void,	  RC_NOCACHE, ST),
  PROC(getacl,	getacl,		getacl,		getacl,	  RC_NOCACHE, ST+1+2*(1+ACL)),
  PROC(getacl,	getacl,		getacl,		getacl,	  RC_NOCACHE, ST+1+2*(1+ACL)),
  PROC(setacl,	setacl,		setacl,		fhandle,  RC_NOCACHE, ST+pAT),
  PROC(setacl,	setacl,		setacl,		fhandle,  RC_NOCACHE, ST+pAT),
Loading