Split buffer overflow checking out of struct nfs4_compound
Subsystems (2)
PATCH 1/1 Split buffer overflow checking out of struct nfs4_compound
Here is the first patch that is part of the crusade 'struct nfs4_compound must die'. It splits out the fields that are meant to do overflow checking, and iovec adjusting on the XDR buffers, and moves that functionality into the dedicated structure 'xdr_stream', and the associated functions 'xdr_inline_encode()', 'xdr_inline_decode()'.
As an added bonus, the patch gets rid of the ugly ENCODE_HEAD, ENCODE_TAIL, ADJUST_ARGS and DECODE_HEAD macros, and quite a lot of the DECODE_TAIL macros.
Cheers,
Trond
fs/nfs/nfs4proc.c +10 -5
@@ -65,11 +65,6 @@memset (cp,0 ,sizeof (*cp)); cp->ops = ops; cp->server = server; - -#if NFS4_DEBUG - cp->taglen =strlen (tag); - cp->tag = tag; -#endif } static void
@@ -373,6 +368,7 @@BUG_ON (cp->flags); + open->op_client_state = cp->server->nfs4_state; open->op_share_access = flags &3 ; open->op_opentype = (flags &O_CREAT ) ?NFS4_OPEN_CREATE :NFS4_OPEN_NOCREATE ; open->op_createmode =NFS4_CREATE_UNCHECKED ;
@@ -527,6 +523,10 @@static void nfs4_setup_renew (struct nfs4_compound *cp) { +struct nfs4_client **client_state =GET_OP (cp, renew); + + *client_state = cp->server->nfs4_state; +OPNUM (cp) =OP_RENEW ; cp->req_nops++; cp->renew_index = cp->req_nops;
@@ -575,6 +575,7 @@sprintf (setclientid->sc_uaddr,"%s.%d.%d" , server->ip_addr, port >>8 , port &255 ); setclientid->sc_prog = program; setclientid->sc_cb_ident =0 ; + setclientid->sc_state = server->nfs4_state;OPNUM (cp) =OP_SETCLIENTID ; cp->req_nops++;
@@ -583,6 +584,10 @@static void nfs4_setup_setclientid_confirm (struct nfs4_compound *cp) { +struct nfs4_client **client_state =GET_OP (cp, setclientid_confirm); + + *client_state = cp->server->nfs4_state; +OPNUM (cp) =OP_SETCLIENTID_CONFIRM ; cp->req_nops++; cp->renew_index = cp->req_nops;
fs/nfs/nfs4xdr.c +244 -293
1,276 lines not on this page · raw message
include/linux/nfs_xdr.h +4 -0
@@ -398,6 +398,7 @@ };struct nfs4_open { +struct nfs4_client * op_client_state;/* request */ u32 op_share_access;/* request */ u32 op_opentype;/* request */ u32 op_createmode;/* request */
@@ -472,6 +473,7 @@char sc_netid[4 ];/* request */ char sc_uaddr[24 ];/* request */ u32 sc_cb_ident;/* request */ +struct nfs4_client * sc_state;/* response */ };struct nfs4_write {
@@ -504,8 +506,10 @@struct nfs4_readlink readlink;struct nfs4_remove remove;struct nfs4_rename rename; +struct nfs4_client * renew;struct nfs4_setattr setattr;struct nfs4_setclientid setclientid; +struct nfs4_client * setclientid_confirm;struct nfs4_write write; } u; };
include/linux/sunrpc/xdr.h +73 -0
79 lines not on this page · raw message
-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing your web site with SSL, click here to get a FREE TRIAL of a Thawte Server Certificate: http://www.gothawte.com/rd524.html
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs