From: Greg Kroah-Hartman Date: Sat, 9 Oct 2021 14:15:47 +0000 (+0200) Subject: 4.9-stable patches X-Git-Tag: v5.14.12~37 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=03e0888964a41dd1adcb825c6f9abe9190dad2af;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: arm-dts-omap3430-sdp-fix-nand-device-node.patch nfsd4-handle-the-nfsv4-readdir-dircount-hint-being-zero.patch ovl-fix-missing-negative-dentry-check-in-ovl_rename.patch --- diff --git a/queue-4.9/arm-dts-omap3430-sdp-fix-nand-device-node.patch b/queue-4.9/arm-dts-omap3430-sdp-fix-nand-device-node.patch new file mode 100644 index 00000000000..a48964fe9fc --- /dev/null +++ b/queue-4.9/arm-dts-omap3430-sdp-fix-nand-device-node.patch @@ -0,0 +1,31 @@ +From 80d680fdccba214e8106dc1aa33de5207ad75394 Mon Sep 17 00:00:00 2001 +From: Roger Quadros +Date: Thu, 2 Sep 2021 12:58:28 +0300 +Subject: ARM: dts: omap3430-sdp: Fix NAND device node + +From: Roger Quadros + +commit 80d680fdccba214e8106dc1aa33de5207ad75394 upstream. + +Nand is on CS1 so reg properties first field should be 1 not 0. + +Fixes: 44e4716499b8 ("ARM: dts: omap3: Fix NAND device nodes") +Cc: stable@vger.kernel.org # v4.6+ +Signed-off-by: Roger Quadros +Signed-off-by: Tony Lindgren +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/boot/dts/omap3430-sdp.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/omap3430-sdp.dts ++++ b/arch/arm/boot/dts/omap3430-sdp.dts +@@ -104,7 +104,7 @@ + + nand@1,0 { + compatible = "ti,omap2-nand"; +- reg = <0 0 4>; /* CS0, offset 0, IO size 4 */ ++ reg = <1 0 4>; /* CS1, offset 0, IO size 4 */ + interrupt-parent = <&gpmc>; + interrupts = <0 IRQ_TYPE_NONE>, /* fifoevent */ + <1 IRQ_TYPE_NONE>; /* termcount */ diff --git a/queue-4.9/nfsd4-handle-the-nfsv4-readdir-dircount-hint-being-zero.patch b/queue-4.9/nfsd4-handle-the-nfsv4-readdir-dircount-hint-being-zero.patch new file mode 100644 index 00000000000..0b85e150868 --- /dev/null +++ b/queue-4.9/nfsd4-handle-the-nfsv4-readdir-dircount-hint-being-zero.patch @@ -0,0 +1,52 @@ +From f2e717d655040d632c9015f19aa4275f8b16e7f2 Mon Sep 17 00:00:00 2001 +From: Trond Myklebust +Date: Thu, 30 Sep 2021 15:44:41 -0400 +Subject: nfsd4: Handle the NFSv4 READDIR 'dircount' hint being zero + +From: Trond Myklebust + +commit f2e717d655040d632c9015f19aa4275f8b16e7f2 upstream. + +RFC3530 notes that the 'dircount' field may be zero, in which case the +recommendation is to ignore it, and only enforce the 'maxcount' field. +In RFC5661, this recommendation to ignore a zero valued field becomes a +requirement. + +Fixes: aee377644146 ("nfsd4: fix rd_dircount enforcement") +Cc: +Signed-off-by: Trond Myklebust +Signed-off-by: Chuck Lever +Signed-off-by: Greg Kroah-Hartman +--- + fs/nfsd/nfs4xdr.c | 19 +++++++++++-------- + 1 file changed, 11 insertions(+), 8 deletions(-) + +--- a/fs/nfsd/nfs4xdr.c ++++ b/fs/nfsd/nfs4xdr.c +@@ -3028,15 +3028,18 @@ nfsd4_encode_dirent(void *ccdv, const ch + 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: diff --git a/queue-4.9/ovl-fix-missing-negative-dentry-check-in-ovl_rename.patch b/queue-4.9/ovl-fix-missing-negative-dentry-check-in-ovl_rename.patch new file mode 100644 index 00000000000..35fd56215e5 --- /dev/null +++ b/queue-4.9/ovl-fix-missing-negative-dentry-check-in-ovl_rename.patch @@ -0,0 +1,62 @@ +From a295aef603e109a47af355477326bd41151765b6 Mon Sep 17 00:00:00 2001 +From: Zheng Liang +Date: Fri, 24 Sep 2021 09:16:27 +0800 +Subject: ovl: fix missing negative dentry check in ovl_rename() + +From: Zheng Liang + +commit a295aef603e109a47af355477326bd41151765b6 upstream. + +The following reproducer + + mkdir lower upper work merge + touch lower/old + touch lower/new + mount -t overlay overlay -olowerdir=lower,upperdir=upper,workdir=work merge + rm merge/new + mv merge/old merge/new & unlink upper/new + +may result in this race: + +PROCESS A: + rename("merge/old", "merge/new"); + overwrite=true,ovl_lower_positive(old)=true, + ovl_dentry_is_whiteout(new)=true -> flags |= RENAME_EXCHANGE + +PROCESS B: + unlink("upper/new"); + +PROCESS A: + lookup newdentry in new_upperdir + call vfs_rename() with negative newdentry and RENAME_EXCHANGE + +Fix by adding the missing check for negative newdentry. + +Signed-off-by: Zheng Liang +Fixes: e9be9d5e76e3 ("overlay filesystem") +Cc: # v3.18 +Signed-off-by: Miklos Szeredi +Signed-off-by: Greg Kroah-Hartman +--- + fs/overlayfs/dir.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +--- a/fs/overlayfs/dir.c ++++ b/fs/overlayfs/dir.c +@@ -926,9 +926,13 @@ static int ovl_rename2(struct inode *old + goto out_dput; + } + } else { +- if (!d_is_negative(newdentry) && +- (!new_opaque || !ovl_is_whiteout(newdentry))) +- goto out_dput; ++ if (!d_is_negative(newdentry)) { ++ if (!new_opaque || !ovl_is_whiteout(newdentry)) ++ goto out_dput; ++ } else { ++ if (flags & RENAME_EXCHANGE) ++ goto out_dput; ++ } + } + + if (olddentry == trap) diff --git a/queue-4.9/series b/queue-4.9/series index e33b831595d..38295e0999e 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -1,3 +1,6 @@ partially-revert-usb-kconfig-using-select-for-usb_common-dependency.patch usb-cdc-acm-fix-racy-tty-buffer-accesses.patch usb-cdc-acm-fix-break-reporting.patch +ovl-fix-missing-negative-dentry-check-in-ovl_rename.patch +nfsd4-handle-the-nfsv4-readdir-dircount-hint-being-zero.patch +arm-dts-omap3430-sdp-fix-nand-device-node.patch