nfs4xdr.c (06981d560606ac48d61e5f4fff6738b925c93173) nfs4xdr.c (3fdc546462348b8a497c72bc894e0cde9f10fc40)
1/*
2 * Server-side XDR for NFSv4
3 *
4 * Copyright (c) 2002 The Regents of the University of Michigan.
5 * All rights reserved.
6 *
7 * Kendrick Smith <kmsmith@umich.edu>
8 * Andy Adamson <andros@umich.edu>

--- 779 unchanged lines hidden (view full) ---

788
789static __be32
790nfsd4_decode_commit(struct nfsd4_compoundargs *argp, struct nfsd4_commit *commit)
791{
792 if (xdr_stream_decode_u64(argp->xdr, &commit->co_offset) < 0)
793 return nfserr_bad_xdr;
794 if (xdr_stream_decode_u32(argp->xdr, &commit->co_count) < 0)
795 return nfserr_bad_xdr;
1/*
2 * Server-side XDR for NFSv4
3 *
4 * Copyright (c) 2002 The Regents of the University of Michigan.
5 * All rights reserved.
6 *
7 * Kendrick Smith <kmsmith@umich.edu>
8 * Andy Adamson <andros@umich.edu>

--- 779 unchanged lines hidden (view full) ---

788
789static __be32
790nfsd4_decode_commit(struct nfsd4_compoundargs *argp, struct nfsd4_commit *commit)
791{
792 if (xdr_stream_decode_u64(argp->xdr, &commit->co_offset) < 0)
793 return nfserr_bad_xdr;
794 if (xdr_stream_decode_u32(argp->xdr, &commit->co_count) < 0)
795 return nfserr_bad_xdr;
796 memset(&commit->co_verf, 0, sizeof(commit->co_verf));
796 return nfs_ok;
797}
798
799static __be32
800nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create)
801{
802 __be32 *p, status;
803
797 return nfs_ok;
798}
799
800static __be32
801nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create)
802{
803 __be32 *p, status;
804
805 memset(create, 0, sizeof(*create));
804 if (xdr_stream_decode_u32(argp->xdr, &create->cr_type) < 0)
805 return nfserr_bad_xdr;
806 switch (create->cr_type) {
807 case NF4LNK:
808 if (xdr_stream_decode_u32(argp->xdr, &create->cr_datalen) < 0)
809 return nfserr_bad_xdr;
810 p = xdr_inline_decode(argp->xdr, create->cr_datalen);
811 if (!p)

--- 33 unchanged lines hidden (view full) ---

845nfsd4_decode_delegreturn(struct nfsd4_compoundargs *argp, struct nfsd4_delegreturn *dr)
846{
847 return nfsd4_decode_stateid4(argp, &dr->dr_stateid);
848}
849
850static inline __be32
851nfsd4_decode_getattr(struct nfsd4_compoundargs *argp, struct nfsd4_getattr *getattr)
852{
806 if (xdr_stream_decode_u32(argp->xdr, &create->cr_type) < 0)
807 return nfserr_bad_xdr;
808 switch (create->cr_type) {
809 case NF4LNK:
810 if (xdr_stream_decode_u32(argp->xdr, &create->cr_datalen) < 0)
811 return nfserr_bad_xdr;
812 p = xdr_inline_decode(argp->xdr, create->cr_datalen);
813 if (!p)

--- 33 unchanged lines hidden (view full) ---

847nfsd4_decode_delegreturn(struct nfsd4_compoundargs *argp, struct nfsd4_delegreturn *dr)
848{
849 return nfsd4_decode_stateid4(argp, &dr->dr_stateid);
850}
851
852static inline __be32
853nfsd4_decode_getattr(struct nfsd4_compoundargs *argp, struct nfsd4_getattr *getattr)
854{
855 memset(getattr, 0, sizeof(*getattr));
853 return nfsd4_decode_bitmap4(argp, getattr->ga_bmval,
854 ARRAY_SIZE(getattr->ga_bmval));
855}
856
857static __be32
858nfsd4_decode_link(struct nfsd4_compoundargs *argp, struct nfsd4_link *link)
859{
856 return nfsd4_decode_bitmap4(argp, getattr->ga_bmval,
857 ARRAY_SIZE(getattr->ga_bmval));
858}
859
860static __be32
861nfsd4_decode_link(struct nfsd4_compoundargs *argp, struct nfsd4_link *link)
862{
863 memset(link, 0, sizeof(*link));
860 return nfsd4_decode_component4(argp, &link->li_name, &link->li_namelen);
861}
862
863static __be32
864nfsd4_decode_open_to_lock_owner4(struct nfsd4_compoundargs *argp,
865 struct nfsd4_lock *lock)
866{
867 __be32 status;

--- 32 unchanged lines hidden (view full) ---

900 if (lock->lk_is_new)
901 return nfsd4_decode_open_to_lock_owner4(argp, lock);
902 return nfsd4_decode_exist_lock_owner4(argp, lock);
903}
904
905static __be32
906nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock)
907{
864 return nfsd4_decode_component4(argp, &link->li_name, &link->li_namelen);
865}
866
867static __be32
868nfsd4_decode_open_to_lock_owner4(struct nfsd4_compoundargs *argp,
869 struct nfsd4_lock *lock)
870{
871 __be32 status;

--- 32 unchanged lines hidden (view full) ---

904 if (lock->lk_is_new)
905 return nfsd4_decode_open_to_lock_owner4(argp, lock);
906 return nfsd4_decode_exist_lock_owner4(argp, lock);
907}
908
909static __be32
910nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock)
911{
912 memset(lock, 0, sizeof(*lock));
908 if (xdr_stream_decode_u32(argp->xdr, &lock->lk_type) < 0)
909 return nfserr_bad_xdr;
910 if ((lock->lk_type < NFS4_READ_LT) || (lock->lk_type > NFS4_WRITEW_LT))
911 return nfserr_bad_xdr;
912 if (xdr_stream_decode_bool(argp->xdr, &lock->lk_reclaim) < 0)
913 return nfserr_bad_xdr;
914 if (xdr_stream_decode_u64(argp->xdr, &lock->lk_offset) < 0)
915 return nfserr_bad_xdr;
916 if (xdr_stream_decode_u64(argp->xdr, &lock->lk_length) < 0)
917 return nfserr_bad_xdr;
918 return nfsd4_decode_locker4(argp, lock);
919}
920
921static __be32
922nfsd4_decode_lockt(struct nfsd4_compoundargs *argp, struct nfsd4_lockt *lockt)
923{
913 if (xdr_stream_decode_u32(argp->xdr, &lock->lk_type) < 0)
914 return nfserr_bad_xdr;
915 if ((lock->lk_type < NFS4_READ_LT) || (lock->lk_type > NFS4_WRITEW_LT))
916 return nfserr_bad_xdr;
917 if (xdr_stream_decode_bool(argp->xdr, &lock->lk_reclaim) < 0)
918 return nfserr_bad_xdr;
919 if (xdr_stream_decode_u64(argp->xdr, &lock->lk_offset) < 0)
920 return nfserr_bad_xdr;
921 if (xdr_stream_decode_u64(argp->xdr, &lock->lk_length) < 0)
922 return nfserr_bad_xdr;
923 return nfsd4_decode_locker4(argp, lock);
924}
925
926static __be32
927nfsd4_decode_lockt(struct nfsd4_compoundargs *argp, struct nfsd4_lockt *lockt)
928{
929 memset(lockt, 0, sizeof(*lockt));
924 if (xdr_stream_decode_u32(argp->xdr, &lockt->lt_type) < 0)
925 return nfserr_bad_xdr;
926 if ((lockt->lt_type < NFS4_READ_LT) || (lockt->lt_type > NFS4_WRITEW_LT))
927 return nfserr_bad_xdr;
928 if (xdr_stream_decode_u64(argp->xdr, &lockt->lt_offset) < 0)
929 return nfserr_bad_xdr;
930 if (xdr_stream_decode_u64(argp->xdr, &lockt->lt_length) < 0)
931 return nfserr_bad_xdr;

--- 205 unchanged lines hidden (view full) ---

1137}
1138
1139static __be32
1140nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
1141{
1142 __be32 status;
1143 u32 dummy;
1144
930 if (xdr_stream_decode_u32(argp->xdr, &lockt->lt_type) < 0)
931 return nfserr_bad_xdr;
932 if ((lockt->lt_type < NFS4_READ_LT) || (lockt->lt_type > NFS4_WRITEW_LT))
933 return nfserr_bad_xdr;
934 if (xdr_stream_decode_u64(argp->xdr, &lockt->lt_offset) < 0)
935 return nfserr_bad_xdr;
936 if (xdr_stream_decode_u64(argp->xdr, &lockt->lt_length) < 0)
937 return nfserr_bad_xdr;

--- 205 unchanged lines hidden (view full) ---

1143}
1144
1145static __be32
1146nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
1147{
1148 __be32 status;
1149 u32 dummy;
1150
1145 memset(open->op_bmval, 0, sizeof(open->op_bmval));
1146 open->op_iattr.ia_valid = 0;
1147 open->op_openowner = NULL;
1151 memset(open, 0, sizeof(*open));
1148
1152
1149 open->op_xdr_error = 0;
1150 if (xdr_stream_decode_u32(argp->xdr, &open->op_seqid) < 0)
1151 return nfserr_bad_xdr;
1152 /* deleg_want is ignored */
1153 status = nfsd4_decode_share_access(argp, &open->op_share_access,
1154 &open->op_deleg_want, &dummy);
1155 if (status)
1156 return status;
1157 status = nfsd4_decode_share_deny(argp, &open->op_share_deny);

--- 18 unchanged lines hidden (view full) ---

1176 return nfserr_notsupp;
1177
1178 status = nfsd4_decode_stateid4(argp, &open_conf->oc_req_stateid);
1179 if (status)
1180 return status;
1181 if (xdr_stream_decode_u32(argp->xdr, &open_conf->oc_seqid) < 0)
1182 return nfserr_bad_xdr;
1183
1153 if (xdr_stream_decode_u32(argp->xdr, &open->op_seqid) < 0)
1154 return nfserr_bad_xdr;
1155 /* deleg_want is ignored */
1156 status = nfsd4_decode_share_access(argp, &open->op_share_access,
1157 &open->op_deleg_want, &dummy);
1158 if (status)
1159 return status;
1160 status = nfsd4_decode_share_deny(argp, &open->op_share_deny);

--- 18 unchanged lines hidden (view full) ---

1179 return nfserr_notsupp;
1180
1181 status = nfsd4_decode_stateid4(argp, &open_conf->oc_req_stateid);
1182 if (status)
1183 return status;
1184 if (xdr_stream_decode_u32(argp->xdr, &open_conf->oc_seqid) < 0)
1185 return nfserr_bad_xdr;
1186
1187 memset(&open_conf->oc_resp_stateid, 0,
1188 sizeof(open_conf->oc_resp_stateid));
1184 return nfs_ok;
1185}
1186
1187static __be32
1188nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_downgrade *open_down)
1189{
1190 __be32 status;
1191
1189 return nfs_ok;
1190}
1191
1192static __be32
1193nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_downgrade *open_down)
1194{
1195 __be32 status;
1196
1197 memset(open_down, 0, sizeof(*open_down));
1192 status = nfsd4_decode_stateid4(argp, &open_down->od_stateid);
1193 if (status)
1194 return status;
1195 if (xdr_stream_decode_u32(argp->xdr, &open_down->od_seqid) < 0)
1196 return nfserr_bad_xdr;
1197 /* deleg_want is ignored */
1198 status = nfsd4_decode_share_access(argp, &open_down->od_share_access,
1199 &open_down->od_deleg_want, NULL);

--- 13 unchanged lines hidden (view full) ---

1213 return nfserr_bad_xdr;
1214 p = xdr_inline_decode(argp->xdr, putfh->pf_fhlen);
1215 if (!p)
1216 return nfserr_bad_xdr;
1217 putfh->pf_fhval = svcxdr_savemem(argp, p, putfh->pf_fhlen);
1218 if (!putfh->pf_fhval)
1219 return nfserr_jukebox;
1220
1198 status = nfsd4_decode_stateid4(argp, &open_down->od_stateid);
1199 if (status)
1200 return status;
1201 if (xdr_stream_decode_u32(argp->xdr, &open_down->od_seqid) < 0)
1202 return nfserr_bad_xdr;
1203 /* deleg_want is ignored */
1204 status = nfsd4_decode_share_access(argp, &open_down->od_share_access,
1205 &open_down->od_deleg_want, NULL);

--- 13 unchanged lines hidden (view full) ---

1219 return nfserr_bad_xdr;
1220 p = xdr_inline_decode(argp->xdr, putfh->pf_fhlen);
1221 if (!p)
1222 return nfserr_bad_xdr;
1223 putfh->pf_fhval = svcxdr_savemem(argp, p, putfh->pf_fhlen);
1224 if (!putfh->pf_fhval)
1225 return nfserr_jukebox;
1226
1227 putfh->no_verify = false;
1221 return nfs_ok;
1222}
1223
1224static __be32
1225nfsd4_decode_putpubfh(struct nfsd4_compoundargs *argp, void *p)
1226{
1227 if (argp->minorversion == 0)
1228 return nfs_ok;
1229 return nfserr_notsupp;
1230}
1231
1232static __be32
1233nfsd4_decode_read(struct nfsd4_compoundargs *argp, struct nfsd4_read *read)
1234{
1235 __be32 status;
1236
1228 return nfs_ok;
1229}
1230
1231static __be32
1232nfsd4_decode_putpubfh(struct nfsd4_compoundargs *argp, void *p)
1233{
1234 if (argp->minorversion == 0)
1235 return nfs_ok;
1236 return nfserr_notsupp;
1237}
1238
1239static __be32
1240nfsd4_decode_read(struct nfsd4_compoundargs *argp, struct nfsd4_read *read)
1241{
1242 __be32 status;
1243
1244 memset(read, 0, sizeof(*read));
1237 status = nfsd4_decode_stateid4(argp, &read->rd_stateid);
1238 if (status)
1239 return status;
1240 if (xdr_stream_decode_u64(argp->xdr, &read->rd_offset) < 0)
1241 return nfserr_bad_xdr;
1242 if (xdr_stream_decode_u32(argp->xdr, &read->rd_length) < 0)
1243 return nfserr_bad_xdr;
1244
1245 return nfs_ok;
1246}
1247
1248static __be32
1249nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *readdir)
1250{
1251 __be32 status;
1252
1245 status = nfsd4_decode_stateid4(argp, &read->rd_stateid);
1246 if (status)
1247 return status;
1248 if (xdr_stream_decode_u64(argp->xdr, &read->rd_offset) < 0)
1249 return nfserr_bad_xdr;
1250 if (xdr_stream_decode_u32(argp->xdr, &read->rd_length) < 0)
1251 return nfserr_bad_xdr;
1252
1253 return nfs_ok;
1254}
1255
1256static __be32
1257nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *readdir)
1258{
1259 __be32 status;
1260
1261 memset(readdir, 0, sizeof(*readdir));
1253 if (xdr_stream_decode_u64(argp->xdr, &readdir->rd_cookie) < 0)
1254 return nfserr_bad_xdr;
1255 status = nfsd4_decode_verifier4(argp, &readdir->rd_verf);
1256 if (status)
1257 return status;
1258 if (xdr_stream_decode_u32(argp->xdr, &readdir->rd_dircount) < 0)
1259 return nfserr_bad_xdr;
1260 if (xdr_stream_decode_u32(argp->xdr, &readdir->rd_maxcount) < 0)
1261 return nfserr_bad_xdr;
1262 if (xdr_stream_decode_uint32_array(argp->xdr, readdir->rd_bmval,
1263 ARRAY_SIZE(readdir->rd_bmval)) < 0)
1264 return nfserr_bad_xdr;
1265
1266 return nfs_ok;
1267}
1268
1269static __be32
1270nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove)
1271{
1262 if (xdr_stream_decode_u64(argp->xdr, &readdir->rd_cookie) < 0)
1263 return nfserr_bad_xdr;
1264 status = nfsd4_decode_verifier4(argp, &readdir->rd_verf);
1265 if (status)
1266 return status;
1267 if (xdr_stream_decode_u32(argp->xdr, &readdir->rd_dircount) < 0)
1268 return nfserr_bad_xdr;
1269 if (xdr_stream_decode_u32(argp->xdr, &readdir->rd_maxcount) < 0)
1270 return nfserr_bad_xdr;
1271 if (xdr_stream_decode_uint32_array(argp->xdr, readdir->rd_bmval,
1272 ARRAY_SIZE(readdir->rd_bmval)) < 0)
1273 return nfserr_bad_xdr;
1274
1275 return nfs_ok;
1276}
1277
1278static __be32
1279nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove)
1280{
1281 memset(&remove->rm_cinfo, 0, sizeof(remove->rm_cinfo));
1272 return nfsd4_decode_component4(argp, &remove->rm_name, &remove->rm_namelen);
1273}
1274
1275static __be32
1276nfsd4_decode_rename(struct nfsd4_compoundargs *argp, struct nfsd4_rename *rename)
1277{
1278 __be32 status;
1279
1282 return nfsd4_decode_component4(argp, &remove->rm_name, &remove->rm_namelen);
1283}
1284
1285static __be32
1286nfsd4_decode_rename(struct nfsd4_compoundargs *argp, struct nfsd4_rename *rename)
1287{
1288 __be32 status;
1289
1290 memset(rename, 0, sizeof(*rename));
1280 status = nfsd4_decode_component4(argp, &rename->rn_sname, &rename->rn_snamelen);
1281 if (status)
1282 return status;
1283 return nfsd4_decode_component4(argp, &rename->rn_tname, &rename->rn_tnamelen);
1284}
1285
1286static __be32
1287nfsd4_decode_renew(struct nfsd4_compoundargs *argp, clientid_t *clientid)
1288{
1289 return nfsd4_decode_clientid4(argp, clientid);
1290}
1291
1292static __be32
1293nfsd4_decode_secinfo(struct nfsd4_compoundargs *argp,
1294 struct nfsd4_secinfo *secinfo)
1295{
1291 status = nfsd4_decode_component4(argp, &rename->rn_sname, &rename->rn_snamelen);
1292 if (status)
1293 return status;
1294 return nfsd4_decode_component4(argp, &rename->rn_tname, &rename->rn_tnamelen);
1295}
1296
1297static __be32
1298nfsd4_decode_renew(struct nfsd4_compoundargs *argp, clientid_t *clientid)
1299{
1300 return nfsd4_decode_clientid4(argp, clientid);
1301}
1302
1303static __be32
1304nfsd4_decode_secinfo(struct nfsd4_compoundargs *argp,
1305 struct nfsd4_secinfo *secinfo)
1306{
1307 secinfo->si_exp = NULL;
1296 return nfsd4_decode_component4(argp, &secinfo->si_name, &secinfo->si_namelen);
1297}
1298
1299static __be32
1300nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *setattr)
1301{
1302 __be32 status;
1303
1308 return nfsd4_decode_component4(argp, &secinfo->si_name, &secinfo->si_namelen);
1309}
1310
1311static __be32
1312nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *setattr)
1313{
1314 __be32 status;
1315
1316 memset(setattr, 0, sizeof(*setattr));
1304 status = nfsd4_decode_stateid4(argp, &setattr->sa_stateid);
1305 if (status)
1306 return status;
1307 return nfsd4_decode_fattr4(argp, setattr->sa_bmval,
1308 ARRAY_SIZE(setattr->sa_bmval),
1309 &setattr->sa_iattr, &setattr->sa_acl,
1310 &setattr->sa_label, NULL);
1311}
1312
1313static __be32
1314nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclientid *setclientid)
1315{
1316 __be32 *p, status;
1317
1317 status = nfsd4_decode_stateid4(argp, &setattr->sa_stateid);
1318 if (status)
1319 return status;
1320 return nfsd4_decode_fattr4(argp, setattr->sa_bmval,
1321 ARRAY_SIZE(setattr->sa_bmval),
1322 &setattr->sa_iattr, &setattr->sa_acl,
1323 &setattr->sa_label, NULL);
1324}
1325
1326static __be32
1327nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclientid *setclientid)
1328{
1329 __be32 *p, status;
1330
1331 memset(setclientid, 0, sizeof(*setclientid));
1332
1318 if (argp->minorversion >= 1)
1319 return nfserr_notsupp;
1320
1321 status = nfsd4_decode_verifier4(argp, &setclientid->se_verf);
1322 if (status)
1323 return status;
1324 status = nfsd4_decode_opaque(argp, &setclientid->se_name);
1325 if (status)

--- 40 unchanged lines hidden (view full) ---

1366}
1367
1368/* Also used for NVERIFY */
1369static __be32
1370nfsd4_decode_verify(struct nfsd4_compoundargs *argp, struct nfsd4_verify *verify)
1371{
1372 __be32 *p, status;
1373
1333 if (argp->minorversion >= 1)
1334 return nfserr_notsupp;
1335
1336 status = nfsd4_decode_verifier4(argp, &setclientid->se_verf);
1337 if (status)
1338 return status;
1339 status = nfsd4_decode_opaque(argp, &setclientid->se_name);
1340 if (status)

--- 40 unchanged lines hidden (view full) ---

1381}
1382
1383/* Also used for NVERIFY */
1384static __be32
1385nfsd4_decode_verify(struct nfsd4_compoundargs *argp, struct nfsd4_verify *verify)
1386{
1387 __be32 *p, status;
1388
1389 memset(verify, 0, sizeof(*verify));
1390
1374 status = nfsd4_decode_bitmap4(argp, verify->ve_bmval,
1375 ARRAY_SIZE(verify->ve_bmval));
1376 if (status)
1377 return status;
1378
1379 /* For convenience's sake, we compare raw xdr'd attributes in
1380 * nfsd4_proc_verify */
1381

--- 23 unchanged lines hidden (view full) ---

1405 return nfserr_bad_xdr;
1406 if (write->wr_stable_how > NFS_FILE_SYNC)
1407 return nfserr_bad_xdr;
1408 if (xdr_stream_decode_u32(argp->xdr, &write->wr_buflen) < 0)
1409 return nfserr_bad_xdr;
1410 if (!xdr_stream_subsegment(argp->xdr, &write->wr_payload, write->wr_buflen))
1411 return nfserr_bad_xdr;
1412
1391 status = nfsd4_decode_bitmap4(argp, verify->ve_bmval,
1392 ARRAY_SIZE(verify->ve_bmval));
1393 if (status)
1394 return status;
1395
1396 /* For convenience's sake, we compare raw xdr'd attributes in
1397 * nfsd4_proc_verify */
1398

--- 23 unchanged lines hidden (view full) ---

1422 return nfserr_bad_xdr;
1423 if (write->wr_stable_how > NFS_FILE_SYNC)
1424 return nfserr_bad_xdr;
1425 if (xdr_stream_decode_u32(argp->xdr, &write->wr_buflen) < 0)
1426 return nfserr_bad_xdr;
1427 if (!xdr_stream_subsegment(argp->xdr, &write->wr_payload, write->wr_buflen))
1428 return nfserr_bad_xdr;
1429
1430 write->wr_bytes_written = 0;
1431 write->wr_how_written = 0;
1432 memset(&write->wr_verifier, 0, sizeof(write->wr_verifier));
1413 return nfs_ok;
1414}
1415
1416static __be32
1417nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_release_lockowner *rlockowner)
1418{
1419 __be32 status;
1420

--- 8 unchanged lines hidden (view full) ---

1429 if (argp->minorversion && !zero_clientid(&rlockowner->rl_clientid))
1430 return nfserr_inval;
1431
1432 return nfs_ok;
1433}
1434
1435static __be32 nfsd4_decode_backchannel_ctl(struct nfsd4_compoundargs *argp, struct nfsd4_backchannel_ctl *bc)
1436{
1433 return nfs_ok;
1434}
1435
1436static __be32
1437nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_release_lockowner *rlockowner)
1438{
1439 __be32 status;
1440

--- 8 unchanged lines hidden (view full) ---

1449 if (argp->minorversion && !zero_clientid(&rlockowner->rl_clientid))
1450 return nfserr_inval;
1451
1452 return nfs_ok;
1453}
1454
1455static __be32 nfsd4_decode_backchannel_ctl(struct nfsd4_compoundargs *argp, struct nfsd4_backchannel_ctl *bc)
1456{
1457 memset(bc, 0, sizeof(*bc));
1437 if (xdr_stream_decode_u32(argp->xdr, &bc->bc_cb_program) < 0)
1438 return nfserr_bad_xdr;
1439 return nfsd4_decode_cb_sec(argp, &bc->bc_cb_sec);
1440}
1441
1442static __be32 nfsd4_decode_bind_conn_to_session(struct nfsd4_compoundargs *argp, struct nfsd4_bind_conn_to_session *bcts)
1443{
1444 u32 use_conn_in_rdma_mode;
1445 __be32 status;
1446
1458 if (xdr_stream_decode_u32(argp->xdr, &bc->bc_cb_program) < 0)
1459 return nfserr_bad_xdr;
1460 return nfsd4_decode_cb_sec(argp, &bc->bc_cb_sec);
1461}
1462
1463static __be32 nfsd4_decode_bind_conn_to_session(struct nfsd4_compoundargs *argp, struct nfsd4_bind_conn_to_session *bcts)
1464{
1465 u32 use_conn_in_rdma_mode;
1466 __be32 status;
1467
1468 memset(bcts, 0, sizeof(*bcts));
1447 status = nfsd4_decode_sessionid4(argp, &bcts->sessionid);
1448 if (status)
1449 return status;
1450 if (xdr_stream_decode_u32(argp->xdr, &bcts->dir) < 0)
1451 return nfserr_bad_xdr;
1452 if (xdr_stream_decode_u32(argp->xdr, &use_conn_in_rdma_mode) < 0)
1453 return nfserr_bad_xdr;
1454

--- 125 unchanged lines hidden (view full) ---

1580}
1581
1582static __be32
1583nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
1584 struct nfsd4_exchange_id *exid)
1585{
1586 __be32 status;
1587
1469 status = nfsd4_decode_sessionid4(argp, &bcts->sessionid);
1470 if (status)
1471 return status;
1472 if (xdr_stream_decode_u32(argp->xdr, &bcts->dir) < 0)
1473 return nfserr_bad_xdr;
1474 if (xdr_stream_decode_u32(argp->xdr, &use_conn_in_rdma_mode) < 0)
1475 return nfserr_bad_xdr;
1476

--- 125 unchanged lines hidden (view full) ---

1602}
1603
1604static __be32
1605nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
1606 struct nfsd4_exchange_id *exid)
1607{
1608 __be32 status;
1609
1610 memset(exid, 0, sizeof(*exid));
1588 status = nfsd4_decode_verifier4(argp, &exid->verifier);
1589 if (status)
1590 return status;
1591 status = nfsd4_decode_opaque(argp, &exid->clname);
1592 if (status)
1593 return status;
1594 if (xdr_stream_decode_u32(argp->xdr, &exid->flags) < 0)
1595 return nfserr_bad_xdr;

--- 36 unchanged lines hidden (view full) ---

1632}
1633
1634static __be32
1635nfsd4_decode_create_session(struct nfsd4_compoundargs *argp,
1636 struct nfsd4_create_session *sess)
1637{
1638 __be32 status;
1639
1611 status = nfsd4_decode_verifier4(argp, &exid->verifier);
1612 if (status)
1613 return status;
1614 status = nfsd4_decode_opaque(argp, &exid->clname);
1615 if (status)
1616 return status;
1617 if (xdr_stream_decode_u32(argp->xdr, &exid->flags) < 0)
1618 return nfserr_bad_xdr;

--- 36 unchanged lines hidden (view full) ---

1655}
1656
1657static __be32
1658nfsd4_decode_create_session(struct nfsd4_compoundargs *argp,
1659 struct nfsd4_create_session *sess)
1660{
1661 __be32 status;
1662
1663 memset(sess, 0, sizeof(*sess));
1640 status = nfsd4_decode_clientid4(argp, &sess->clientid);
1641 if (status)
1642 return status;
1643 if (xdr_stream_decode_u32(argp->xdr, &sess->seqid) < 0)
1644 return nfserr_bad_xdr;
1645 if (xdr_stream_decode_u32(argp->xdr, &sess->flags) < 0)
1646 return nfserr_bad_xdr;
1647 status = nfsd4_decode_channel_attrs4(argp, &sess->fore_channel);
1648 if (status)
1649 return status;
1650 status = nfsd4_decode_channel_attrs4(argp, &sess->back_channel);
1651 if (status)
1652 return status;
1653 if (xdr_stream_decode_u32(argp->xdr, &sess->callback_prog) < 0)
1654 return nfserr_bad_xdr;
1664 status = nfsd4_decode_clientid4(argp, &sess->clientid);
1665 if (status)
1666 return status;
1667 if (xdr_stream_decode_u32(argp->xdr, &sess->seqid) < 0)
1668 return nfserr_bad_xdr;
1669 if (xdr_stream_decode_u32(argp->xdr, &sess->flags) < 0)
1670 return nfserr_bad_xdr;
1671 status = nfsd4_decode_channel_attrs4(argp, &sess->fore_channel);
1672 if (status)
1673 return status;
1674 status = nfsd4_decode_channel_attrs4(argp, &sess->back_channel);
1675 if (status)
1676 return status;
1677 if (xdr_stream_decode_u32(argp->xdr, &sess->callback_prog) < 0)
1678 return nfserr_bad_xdr;
1655 status = nfsd4_decode_cb_sec(argp, &sess->cb_sec);
1656 if (status)
1657 return status;
1658
1659 return nfs_ok;
1679 return nfsd4_decode_cb_sec(argp, &sess->cb_sec);
1660}
1661
1662static __be32
1663nfsd4_decode_destroy_session(struct nfsd4_compoundargs *argp,
1664 struct nfsd4_destroy_session *destroy_session)
1665{
1666 return nfsd4_decode_sessionid4(argp, &destroy_session->sessionid);
1667}

--- 7 unchanged lines hidden (view full) ---

1675
1676#ifdef CONFIG_NFSD_PNFS
1677static __be32
1678nfsd4_decode_getdeviceinfo(struct nfsd4_compoundargs *argp,
1679 struct nfsd4_getdeviceinfo *gdev)
1680{
1681 __be32 status;
1682
1680}
1681
1682static __be32
1683nfsd4_decode_destroy_session(struct nfsd4_compoundargs *argp,
1684 struct nfsd4_destroy_session *destroy_session)
1685{
1686 return nfsd4_decode_sessionid4(argp, &destroy_session->sessionid);
1687}

--- 7 unchanged lines hidden (view full) ---

1695
1696#ifdef CONFIG_NFSD_PNFS
1697static __be32
1698nfsd4_decode_getdeviceinfo(struct nfsd4_compoundargs *argp,
1699 struct nfsd4_getdeviceinfo *gdev)
1700{
1701 __be32 status;
1702
1703 memset(gdev, 0, sizeof(*gdev));
1683 status = nfsd4_decode_deviceid4(argp, &gdev->gd_devid);
1684 if (status)
1685 return status;
1686 if (xdr_stream_decode_u32(argp->xdr, &gdev->gd_layout_type) < 0)
1687 return nfserr_bad_xdr;
1688 if (xdr_stream_decode_u32(argp->xdr, &gdev->gd_maxcount) < 0)
1689 return nfserr_bad_xdr;
1690 if (xdr_stream_decode_uint32_array(argp->xdr,

--- 4 unchanged lines hidden (view full) ---

1695}
1696
1697static __be32
1698nfsd4_decode_layoutcommit(struct nfsd4_compoundargs *argp,
1699 struct nfsd4_layoutcommit *lcp)
1700{
1701 __be32 *p, status;
1702
1704 status = nfsd4_decode_deviceid4(argp, &gdev->gd_devid);
1705 if (status)
1706 return status;
1707 if (xdr_stream_decode_u32(argp->xdr, &gdev->gd_layout_type) < 0)
1708 return nfserr_bad_xdr;
1709 if (xdr_stream_decode_u32(argp->xdr, &gdev->gd_maxcount) < 0)
1710 return nfserr_bad_xdr;
1711 if (xdr_stream_decode_uint32_array(argp->xdr,

--- 4 unchanged lines hidden (view full) ---

1716}
1717
1718static __be32
1719nfsd4_decode_layoutcommit(struct nfsd4_compoundargs *argp,
1720 struct nfsd4_layoutcommit *lcp)
1721{
1722 __be32 *p, status;
1723
1724 memset(lcp, 0, sizeof(*lcp));
1703 if (xdr_stream_decode_u64(argp->xdr, &lcp->lc_seg.offset) < 0)
1704 return nfserr_bad_xdr;
1705 if (xdr_stream_decode_u64(argp->xdr, &lcp->lc_seg.length) < 0)
1706 return nfserr_bad_xdr;
1707 if (xdr_stream_decode_bool(argp->xdr, &lcp->lc_reclaim) < 0)
1708 return nfserr_bad_xdr;
1709 status = nfsd4_decode_stateid4(argp, &lcp->lc_sid);
1710 if (status)

--- 19 unchanged lines hidden (view full) ---

1730}
1731
1732static __be32
1733nfsd4_decode_layoutget(struct nfsd4_compoundargs *argp,
1734 struct nfsd4_layoutget *lgp)
1735{
1736 __be32 status;
1737
1725 if (xdr_stream_decode_u64(argp->xdr, &lcp->lc_seg.offset) < 0)
1726 return nfserr_bad_xdr;
1727 if (xdr_stream_decode_u64(argp->xdr, &lcp->lc_seg.length) < 0)
1728 return nfserr_bad_xdr;
1729 if (xdr_stream_decode_bool(argp->xdr, &lcp->lc_reclaim) < 0)
1730 return nfserr_bad_xdr;
1731 status = nfsd4_decode_stateid4(argp, &lcp->lc_sid);
1732 if (status)

--- 19 unchanged lines hidden (view full) ---

1752}
1753
1754static __be32
1755nfsd4_decode_layoutget(struct nfsd4_compoundargs *argp,
1756 struct nfsd4_layoutget *lgp)
1757{
1758 __be32 status;
1759
1760 memset(lgp, 0, sizeof(*lgp));
1738 if (xdr_stream_decode_u32(argp->xdr, &lgp->lg_signal) < 0)
1739 return nfserr_bad_xdr;
1740 if (xdr_stream_decode_u32(argp->xdr, &lgp->lg_layout_type) < 0)
1741 return nfserr_bad_xdr;
1742 if (xdr_stream_decode_u32(argp->xdr, &lgp->lg_seg.iomode) < 0)
1743 return nfserr_bad_xdr;
1744 if (xdr_stream_decode_u64(argp->xdr, &lgp->lg_seg.offset) < 0)
1745 return nfserr_bad_xdr;

--- 9 unchanged lines hidden (view full) ---

1755
1756 return nfs_ok;
1757}
1758
1759static __be32
1760nfsd4_decode_layoutreturn(struct nfsd4_compoundargs *argp,
1761 struct nfsd4_layoutreturn *lrp)
1762{
1761 if (xdr_stream_decode_u32(argp->xdr, &lgp->lg_signal) < 0)
1762 return nfserr_bad_xdr;
1763 if (xdr_stream_decode_u32(argp->xdr, &lgp->lg_layout_type) < 0)
1764 return nfserr_bad_xdr;
1765 if (xdr_stream_decode_u32(argp->xdr, &lgp->lg_seg.iomode) < 0)
1766 return nfserr_bad_xdr;
1767 if (xdr_stream_decode_u64(argp->xdr, &lgp->lg_seg.offset) < 0)
1768 return nfserr_bad_xdr;

--- 9 unchanged lines hidden (view full) ---

1778
1779 return nfs_ok;
1780}
1781
1782static __be32
1783nfsd4_decode_layoutreturn(struct nfsd4_compoundargs *argp,
1784 struct nfsd4_layoutreturn *lrp)
1785{
1786 memset(lrp, 0, sizeof(*lrp));
1763 if (xdr_stream_decode_bool(argp->xdr, &lrp->lr_reclaim) < 0)
1764 return nfserr_bad_xdr;
1765 if (xdr_stream_decode_u32(argp->xdr, &lrp->lr_layout_type) < 0)
1766 return nfserr_bad_xdr;
1767 if (xdr_stream_decode_u32(argp->xdr, &lrp->lr_seg.iomode) < 0)
1768 return nfserr_bad_xdr;
1769 return nfsd4_decode_layoutreturn4(argp, lrp);
1770}
1771#endif /* CONFIG_NFSD_PNFS */
1772
1773static __be32 nfsd4_decode_secinfo_no_name(struct nfsd4_compoundargs *argp,
1774 struct nfsd4_secinfo_no_name *sin)
1775{
1776 if (xdr_stream_decode_u32(argp->xdr, &sin->sin_style) < 0)
1777 return nfserr_bad_xdr;
1787 if (xdr_stream_decode_bool(argp->xdr, &lrp->lr_reclaim) < 0)
1788 return nfserr_bad_xdr;
1789 if (xdr_stream_decode_u32(argp->xdr, &lrp->lr_layout_type) < 0)
1790 return nfserr_bad_xdr;
1791 if (xdr_stream_decode_u32(argp->xdr, &lrp->lr_seg.iomode) < 0)
1792 return nfserr_bad_xdr;
1793 return nfsd4_decode_layoutreturn4(argp, lrp);
1794}
1795#endif /* CONFIG_NFSD_PNFS */
1796
1797static __be32 nfsd4_decode_secinfo_no_name(struct nfsd4_compoundargs *argp,
1798 struct nfsd4_secinfo_no_name *sin)
1799{
1800 if (xdr_stream_decode_u32(argp->xdr, &sin->sin_style) < 0)
1801 return nfserr_bad_xdr;
1802
1803 sin->sin_exp = NULL;
1778 return nfs_ok;
1779}
1780
1781static __be32
1782nfsd4_decode_sequence(struct nfsd4_compoundargs *argp,
1783 struct nfsd4_sequence *seq)
1784{
1785 __be32 *p, status;

--- 4 unchanged lines hidden (view full) ---

1790 p = xdr_inline_decode(argp->xdr, XDR_UNIT * 4);
1791 if (!p)
1792 return nfserr_bad_xdr;
1793 seq->seqid = be32_to_cpup(p++);
1794 seq->slotid = be32_to_cpup(p++);
1795 seq->maxslots = be32_to_cpup(p++);
1796 seq->cachethis = be32_to_cpup(p);
1797
1804 return nfs_ok;
1805}
1806
1807static __be32
1808nfsd4_decode_sequence(struct nfsd4_compoundargs *argp,
1809 struct nfsd4_sequence *seq)
1810{
1811 __be32 *p, status;

--- 4 unchanged lines hidden (view full) ---

1816 p = xdr_inline_decode(argp->xdr, XDR_UNIT * 4);
1817 if (!p)
1818 return nfserr_bad_xdr;
1819 seq->seqid = be32_to_cpup(p++);
1820 seq->slotid = be32_to_cpup(p++);
1821 seq->maxslots = be32_to_cpup(p++);
1822 seq->cachethis = be32_to_cpup(p);
1823
1824 seq->status_flags = 0;
1798 return nfs_ok;
1799}
1800
1801static __be32
1802nfsd4_decode_test_stateid(struct nfsd4_compoundargs *argp, struct nfsd4_test_stateid *test_stateid)
1803{
1804 struct nfsd4_test_stateid_id *stateid;
1805 __be32 status;
1806 u32 i;
1807
1825 return nfs_ok;
1826}
1827
1828static __be32
1829nfsd4_decode_test_stateid(struct nfsd4_compoundargs *argp, struct nfsd4_test_stateid *test_stateid)
1830{
1831 struct nfsd4_test_stateid_id *stateid;
1832 __be32 status;
1833 u32 i;
1834
1835 memset(test_stateid, 0, sizeof(*test_stateid));
1808 if (xdr_stream_decode_u32(argp->xdr, &test_stateid->ts_num_ids) < 0)
1809 return nfserr_bad_xdr;
1810
1811 INIT_LIST_HEAD(&test_stateid->ts_stateid_list);
1812 for (i = 0; i < test_stateid->ts_num_ids; i++) {
1813 stateid = svcxdr_tmpalloc(argp, sizeof(*stateid));
1814 if (!stateid)
1815 return nfserr_jukebox;

--- 81 unchanged lines hidden (view full) ---

1897
1898static __be32
1899nfsd4_decode_copy(struct nfsd4_compoundargs *argp, struct nfsd4_copy *copy)
1900{
1901 u32 consecutive, i, count, sync;
1902 struct nl4_server *ns_dummy;
1903 __be32 status;
1904
1836 if (xdr_stream_decode_u32(argp->xdr, &test_stateid->ts_num_ids) < 0)
1837 return nfserr_bad_xdr;
1838
1839 INIT_LIST_HEAD(&test_stateid->ts_stateid_list);
1840 for (i = 0; i < test_stateid->ts_num_ids; i++) {
1841 stateid = svcxdr_tmpalloc(argp, sizeof(*stateid));
1842 if (!stateid)
1843 return nfserr_jukebox;

--- 81 unchanged lines hidden (view full) ---

1925
1926static __be32
1927nfsd4_decode_copy(struct nfsd4_compoundargs *argp, struct nfsd4_copy *copy)
1928{
1929 u32 consecutive, i, count, sync;
1930 struct nl4_server *ns_dummy;
1931 __be32 status;
1932
1933 memset(copy, 0, sizeof(*copy));
1905 status = nfsd4_decode_stateid4(argp, &copy->cp_src_stateid);
1906 if (status)
1907 return status;
1908 status = nfsd4_decode_stateid4(argp, &copy->cp_dst_stateid);
1909 if (status)
1910 return status;
1911 if (xdr_stream_decode_u64(argp->xdr, &copy->cp_src_pos) < 0)
1912 return nfserr_bad_xdr;

--- 39 unchanged lines hidden (view full) ---

1952}
1953
1954static __be32
1955nfsd4_decode_copy_notify(struct nfsd4_compoundargs *argp,
1956 struct nfsd4_copy_notify *cn)
1957{
1958 __be32 status;
1959
1934 status = nfsd4_decode_stateid4(argp, &copy->cp_src_stateid);
1935 if (status)
1936 return status;
1937 status = nfsd4_decode_stateid4(argp, &copy->cp_dst_stateid);
1938 if (status)
1939 return status;
1940 if (xdr_stream_decode_u64(argp->xdr, &copy->cp_src_pos) < 0)
1941 return nfserr_bad_xdr;

--- 39 unchanged lines hidden (view full) ---

1981}
1982
1983static __be32
1984nfsd4_decode_copy_notify(struct nfsd4_compoundargs *argp,
1985 struct nfsd4_copy_notify *cn)
1986{
1987 __be32 status;
1988
1989 memset(cn, 0, sizeof(*cn));
1960 cn->cpn_src = svcxdr_tmpalloc(argp, sizeof(*cn->cpn_src));
1961 if (cn->cpn_src == NULL)
1962 return nfserr_jukebox;
1963 cn->cpn_dst = svcxdr_tmpalloc(argp, sizeof(*cn->cpn_dst));
1964 if (cn->cpn_dst == NULL)
1965 return nfserr_jukebox;
1966
1967 status = nfsd4_decode_stateid4(argp, &cn->cpn_src_stateid);
1968 if (status)
1969 return status;
1970 return nfsd4_decode_nl4_server(argp, cn->cpn_dst);
1971}
1972
1973static __be32
1974nfsd4_decode_offload_status(struct nfsd4_compoundargs *argp,
1975 struct nfsd4_offload_status *os)
1976{
1990 cn->cpn_src = svcxdr_tmpalloc(argp, sizeof(*cn->cpn_src));
1991 if (cn->cpn_src == NULL)
1992 return nfserr_jukebox;
1993 cn->cpn_dst = svcxdr_tmpalloc(argp, sizeof(*cn->cpn_dst));
1994 if (cn->cpn_dst == NULL)
1995 return nfserr_jukebox;
1996
1997 status = nfsd4_decode_stateid4(argp, &cn->cpn_src_stateid);
1998 if (status)
1999 return status;
2000 return nfsd4_decode_nl4_server(argp, cn->cpn_dst);
2001}
2002
2003static __be32
2004nfsd4_decode_offload_status(struct nfsd4_compoundargs *argp,
2005 struct nfsd4_offload_status *os)
2006{
2007 os->count = 0;
2008 os->status = 0;
1977 return nfsd4_decode_stateid4(argp, &os->stateid);
1978}
1979
1980static __be32
1981nfsd4_decode_seek(struct nfsd4_compoundargs *argp, struct nfsd4_seek *seek)
1982{
1983 __be32 status;
1984
1985 status = nfsd4_decode_stateid4(argp, &seek->seek_stateid);
1986 if (status)
1987 return status;
1988 if (xdr_stream_decode_u64(argp->xdr, &seek->seek_offset) < 0)
1989 return nfserr_bad_xdr;
1990 if (xdr_stream_decode_u32(argp->xdr, &seek->seek_whence) < 0)
1991 return nfserr_bad_xdr;
1992
2009 return nfsd4_decode_stateid4(argp, &os->stateid);
2010}
2011
2012static __be32
2013nfsd4_decode_seek(struct nfsd4_compoundargs *argp, struct nfsd4_seek *seek)
2014{
2015 __be32 status;
2016
2017 status = nfsd4_decode_stateid4(argp, &seek->seek_stateid);
2018 if (status)
2019 return status;
2020 if (xdr_stream_decode_u64(argp->xdr, &seek->seek_offset) < 0)
2021 return nfserr_bad_xdr;
2022 if (xdr_stream_decode_u32(argp->xdr, &seek->seek_whence) < 0)
2023 return nfserr_bad_xdr;
2024
2025 seek->seek_eof = 0;
2026 seek->seek_pos = 0;
1993 return nfs_ok;
1994}
1995
1996static __be32
1997nfsd4_decode_clone(struct nfsd4_compoundargs *argp, struct nfsd4_clone *clone)
1998{
1999 __be32 status;
2000

--- 119 unchanged lines hidden (view full) ---

2120 */
2121static __be32
2122nfsd4_decode_getxattr(struct nfsd4_compoundargs *argp,
2123 struct nfsd4_getxattr *getxattr)
2124{
2125 __be32 status;
2126 u32 maxcount;
2127
2027 return nfs_ok;
2028}
2029
2030static __be32
2031nfsd4_decode_clone(struct nfsd4_compoundargs *argp, struct nfsd4_clone *clone)
2032{
2033 __be32 status;
2034

--- 119 unchanged lines hidden (view full) ---

2154 */
2155static __be32
2156nfsd4_decode_getxattr(struct nfsd4_compoundargs *argp,
2157 struct nfsd4_getxattr *getxattr)
2158{
2159 __be32 status;
2160 u32 maxcount;
2161
2162 memset(getxattr, 0, sizeof(*getxattr));
2128 status = nfsd4_decode_xattr_name(argp, &getxattr->getxa_name);
2129 if (status)
2130 return status;
2131
2132 maxcount = svc_max_payload(argp->rqstp);
2133 maxcount = min_t(u32, XATTR_SIZE_MAX, maxcount);
2134
2135 getxattr->getxa_len = maxcount;
2163 status = nfsd4_decode_xattr_name(argp, &getxattr->getxa_name);
2164 if (status)
2165 return status;
2166
2167 maxcount = svc_max_payload(argp->rqstp);
2168 maxcount = min_t(u32, XATTR_SIZE_MAX, maxcount);
2169
2170 getxattr->getxa_len = maxcount;
2136
2137 return status;
2171 return nfs_ok;
2138}
2139
2140static __be32
2141nfsd4_decode_setxattr(struct nfsd4_compoundargs *argp,
2142 struct nfsd4_setxattr *setxattr)
2143{
2144 u32 flags, maxcount, size;
2145 __be32 status;
2146
2172}
2173
2174static __be32
2175nfsd4_decode_setxattr(struct nfsd4_compoundargs *argp,
2176 struct nfsd4_setxattr *setxattr)
2177{
2178 u32 flags, maxcount, size;
2179 __be32 status;
2180
2181 memset(setxattr, 0, sizeof(*setxattr));
2182
2147 if (xdr_stream_decode_u32(argp->xdr, &flags) < 0)
2148 return nfserr_bad_xdr;
2149
2150 if (flags > SETXATTR4_REPLACE)
2151 return nfserr_inval;
2152 setxattr->setxa_flags = flags;
2153
2154 status = nfsd4_decode_xattr_name(argp, &setxattr->setxa_name);

--- 22 unchanged lines hidden (view full) ---

2177}
2178
2179static __be32
2180nfsd4_decode_listxattrs(struct nfsd4_compoundargs *argp,
2181 struct nfsd4_listxattrs *listxattrs)
2182{
2183 u32 maxcount;
2184
2183 if (xdr_stream_decode_u32(argp->xdr, &flags) < 0)
2184 return nfserr_bad_xdr;
2185
2186 if (flags > SETXATTR4_REPLACE)
2187 return nfserr_inval;
2188 setxattr->setxa_flags = flags;
2189
2190 status = nfsd4_decode_xattr_name(argp, &setxattr->setxa_name);

--- 22 unchanged lines hidden (view full) ---

2213}
2214
2215static __be32
2216nfsd4_decode_listxattrs(struct nfsd4_compoundargs *argp,
2217 struct nfsd4_listxattrs *listxattrs)
2218{
2219 u32 maxcount;
2220
2221 memset(listxattrs, 0, sizeof(*listxattrs));
2222
2185 if (xdr_stream_decode_u64(argp->xdr, &listxattrs->lsxa_cookie) < 0)
2186 return nfserr_bad_xdr;
2187
2188 /*
2189 * If the cookie is too large to have even one user.x attribute
2190 * plus trailing '\0' left in a maximum size buffer, it's invalid.
2191 */
2192 if (listxattrs->lsxa_cookie >=

--- 11 unchanged lines hidden (view full) ---

2204
2205 return nfs_ok;
2206}
2207
2208static __be32
2209nfsd4_decode_removexattr(struct nfsd4_compoundargs *argp,
2210 struct nfsd4_removexattr *removexattr)
2211{
2223 if (xdr_stream_decode_u64(argp->xdr, &listxattrs->lsxa_cookie) < 0)
2224 return nfserr_bad_xdr;
2225
2226 /*
2227 * If the cookie is too large to have even one user.x attribute
2228 * plus trailing '\0' left in a maximum size buffer, it's invalid.
2229 */
2230 if (listxattrs->lsxa_cookie >=

--- 11 unchanged lines hidden (view full) ---

2242
2243 return nfs_ok;
2244}
2245
2246static __be32
2247nfsd4_decode_removexattr(struct nfsd4_compoundargs *argp,
2248 struct nfsd4_removexattr *removexattr)
2249{
2250 memset(removexattr, 0, sizeof(*removexattr));
2212 return nfsd4_decode_xattr_name(argp, &removexattr->rmxa_name);
2213}
2214
2215static __be32
2216nfsd4_decode_noop(struct nfsd4_compoundargs *argp, void *p)
2217{
2218 return nfs_ok;
2219}

--- 3227 unchanged lines hidden ---
2251 return nfsd4_decode_xattr_name(argp, &removexattr->rmxa_name);
2252}
2253
2254static __be32
2255nfsd4_decode_noop(struct nfsd4_compoundargs *argp, void *p)
2256{
2257 return nfs_ok;
2258}

--- 3227 unchanged lines hidden ---