Skip to content

Commit ccd1cdc

Browse files
committed
Merge tag 'nfsd-6.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
Pull nfsd fixes from Chuck Lever: "A set of NFSD fixes that arrived just a bit late for the 6.19 merge window. Regression fixes: - Mark variable __maybe_unused to avoid W=1 build break Stable fixes: - NFSv4 file creation neglects setting ACL - Clear TIME_DELEG in the suppattr_exclcreat bitmap - Clear SECLABEL in the suppattr_exclcreat bitmap - Fix memory leak in nfsd_create_serv error paths - Bound check rq_pages index in inline path - Return 0 on success from svc_rdma_copy_inline_range - Use rc_pageoff for memcpy byte offset - Avoid NULL deref on zero length gss_token in gss_read_proxy_verf" * tag 'nfsd-6.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: NFSD: NFSv4 file creation neglects setting ACL NFSD: Clear TIME_DELEG in the suppattr_exclcreat bitmap NFSD: Clear SECLABEL in the suppattr_exclcreat bitmap nfsd: fix memory leak in nfsd_create_serv error paths nfsd: Mark variable __maybe_unused to avoid W=1 build break svcrdma: bound check rq_pages index in inline path svcrdma: return 0 on success from svc_rdma_copy_inline_range svcrdma: use rc_pageoff for memcpy byte offset SUNRPC: svcauth_gss: avoid NULL deref on zero length gss_token in gss_read_proxy_verf
2 parents ce93692 + 913f7cf commit ccd1cdc

7 files changed

Lines changed: 26 additions & 7 deletions

File tree

fs/nfsd/export.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ exp_rootfh(struct net *net, struct auth_domain *clp, char *name,
10241024
{
10251025
struct svc_export *exp;
10261026
struct path path;
1027-
struct inode *inode;
1027+
struct inode *inode __maybe_unused;
10281028
struct svc_fh fh;
10291029
int err;
10301030
struct nfsd_net *nn = net_generic(net, nfsd_net_id);

fs/nfsd/nfs4xdr.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3375,6 +3375,11 @@ static __be32 nfsd4_encode_fattr4_suppattr_exclcreat(struct xdr_stream *xdr,
33753375
u32 supp[3];
33763376

33773377
memcpy(supp, nfsd_suppattrs[resp->cstate.minorversion], sizeof(supp));
3378+
if (!IS_POSIXACL(d_inode(args->dentry)))
3379+
supp[0] &= ~FATTR4_WORD0_ACL;
3380+
if (!args->contextsupport)
3381+
supp[2] &= ~FATTR4_WORD2_SECURITY_LABEL;
3382+
33783383
supp[0] &= NFSD_SUPPATTR_EXCLCREAT_WORD0;
33793384
supp[1] &= NFSD_SUPPATTR_EXCLCREAT_WORD1;
33803385
supp[2] &= NFSD_SUPPATTR_EXCLCREAT_WORD2;

fs/nfsd/nfsd.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,14 @@ static inline bool nfsd_attrs_supported(u32 minorversion, const u32 *bmval)
547547
#define NFSD_SUPPATTR_EXCLCREAT_WORD1 \
548548
(NFSD_WRITEABLE_ATTRS_WORD1 & \
549549
~(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET))
550+
/*
551+
* The FATTR4_WORD2_TIME_DELEG attributes are not to be allowed for
552+
* OPEN(create) with EXCLUSIVE4_1. It doesn't make sense to set a
553+
* delegated timestamp on a new file.
554+
*/
550555
#define NFSD_SUPPATTR_EXCLCREAT_WORD2 \
551-
NFSD_WRITEABLE_ATTRS_WORD2
556+
(NFSD_WRITEABLE_ATTRS_WORD2 & \
557+
~(FATTR4_WORD2_TIME_DELEG_ACCESS | FATTR4_WORD2_TIME_DELEG_MODIFY))
552558

553559
extern int nfsd4_is_junction(struct dentry *dentry);
554560
extern int register_cld_notifier(void);

fs/nfsd/nfssvc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,12 +615,15 @@ int nfsd_create_serv(struct net *net)
615615
serv = svc_create_pooled(nfsd_programs, ARRAY_SIZE(nfsd_programs),
616616
&nn->nfsd_svcstats,
617617
nfsd_max_blksize, nfsd);
618-
if (serv == NULL)
618+
if (serv == NULL) {
619+
percpu_ref_exit(&nn->nfsd_net_ref);
619620
return -ENOMEM;
621+
}
620622

621623
error = svc_bind(serv, net);
622624
if (error < 0) {
623625
svc_destroy(&serv);
626+
percpu_ref_exit(&nn->nfsd_net_ref);
624627
return error;
625628
}
626629
spin_lock(&nfsd_notifier_lock);

fs/nfsd/vfs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ static inline bool nfsd_attrs_valid(struct nfsd_attrs *attrs)
6767
struct iattr *iap = attrs->na_iattr;
6868

6969
return (iap->ia_valid || (attrs->na_seclabel &&
70-
attrs->na_seclabel->len));
70+
attrs->na_seclabel->len) ||
71+
attrs->na_pacl || attrs->na_dpacl);
7172
}
7273

7374
__be32 nfserrno (int errno);

net/sunrpc/auth_gss/svcauth_gss.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,8 @@ static int gss_read_proxy_verf(struct svc_rqst *rqstp,
10831083
}
10841084

10851085
length = min_t(unsigned int, inlen, (char *)xdr->end - (char *)xdr->p);
1086-
memcpy(page_address(in_token->pages[0]), xdr->p, length);
1086+
if (length)
1087+
memcpy(page_address(in_token->pages[0]), xdr->p, length);
10871088
inlen -= length;
10881089

10891090
to_offs = length;

net/sunrpc/xprtrdma/svc_rdma_rw.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -841,14 +841,17 @@ static int svc_rdma_copy_inline_range(struct svc_rqst *rqstp,
841841
for (page_no = 0; page_no < numpages; page_no++) {
842842
unsigned int page_len;
843843

844+
if (head->rc_curpage >= rqstp->rq_maxpages)
845+
return -EINVAL;
846+
844847
page_len = min_t(unsigned int, remaining,
845848
PAGE_SIZE - head->rc_pageoff);
846849

847850
if (!head->rc_pageoff)
848851
head->rc_page_count++;
849852

850853
dst = page_address(rqstp->rq_pages[head->rc_curpage]);
851-
memcpy(dst + head->rc_curpage, src + offset, page_len);
854+
memcpy((unsigned char *)dst + head->rc_pageoff, src + offset, page_len);
852855

853856
head->rc_readbytes += page_len;
854857
head->rc_pageoff += page_len;
@@ -860,7 +863,7 @@ static int svc_rdma_copy_inline_range(struct svc_rqst *rqstp,
860863
offset += page_len;
861864
}
862865

863-
return -EINVAL;
866+
return 0;
864867
}
865868

866869
/**

0 commit comments

Comments
 (0)