diff options
author | Greg Kroah-Hartman <gregkh@google.com> | 2021-10-17 10:35:21 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2021-10-17 10:35:21 +0200 |
commit | bf687da3fdbe378ae33b7d4c6cbaa2dfa3993628 (patch) | |
tree | 436e96697c57da01a075b5ab299edd5ecb5d9cea /fs | |
parent | b8841c043898aca3016c3f0432be5332fb3f9b17 (diff) | |
parent | c67099a5bc53d1a24058ba5afe873f16cd290e16 (diff) |
Merge 4.4.289 into android-4.4-p
Changes in 4.4.289
USB: cdc-acm: fix racy tty buffer accesses
USB: cdc-acm: fix break reporting
nfsd4: Handle the NFSv4 READDIR 'dircount' hint being zero
xtensa: call irqchip_init only when CONFIG_USE_OF is selected
phy: mdio: fix memory leak
net_sched: fix NULL deref in fifo_set_limit()
ptp_pch: Load module automatically if ID matches
ARM: imx6: disable the GIC CPU interface before calling stby-poweroff sequence
netlink: annotate data races around nlk->bound
i40e: fix endless loop under rtnl
gup: document and work around "COW can break either way" issue
mm: check VMA flags to avoid invalid PROT_NONE NUMA balancing
HID: apple: Fix logical maximum and usage maximum of Magic Keyboard JIS
netfilter: ip6_tables: zero-initialize fragment offset
mac80211: Drop frames from invalid MAC address in ad-hoc mode
scsi: ses: Fix unsigned comparison with less than zero
scsi: virtio_scsi: Fix spelling mistake "Unsupport" -> "Unsupported"
perf/x86: Reset destroy callback on event init failure
Linux 4.4.289
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I3a65de3023522d2c5370858c3f0e98e86ad6b7ff
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index ee0da259a3d3..87708608c0ff 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -2988,15 +2988,18 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen, goto fail; cd->rd_maxcount -= entry_bytes; /* - * RFC 3530 14.2.24 describes rd_dircount as only a "hint", so - * let's always let through the first entry, at least: + * RFC 3530 14.2.24 describes rd_dircount as only a "hint", and + * notes that it could be zero. If it is zero, then the server + * should enforce only the rd_maxcount value. */ - if (!cd->rd_dircount) - goto fail; - name_and_cookie = 4 + 4 * XDR_QUADLEN(namlen) + 8; - if (name_and_cookie > cd->rd_dircount && cd->cookie_offset) - goto fail; - cd->rd_dircount -= min(cd->rd_dircount, name_and_cookie); + if (cd->rd_dircount) { + name_and_cookie = 4 + 4 * XDR_QUADLEN(namlen) + 8; + if (name_and_cookie > cd->rd_dircount && cd->cookie_offset) + goto fail; + cd->rd_dircount -= min(cd->rd_dircount, name_and_cookie); + if (!cd->rd_dircount) + cd->rd_maxcount = 0; + } cd->cookie_offset = cookie_offset; skip_entry: |