From fad9a8841b67ee9e09dd352785e24d9b9d22e11c Mon Sep 17 00:00:00 2001 From: obadz Date: Wed, 13 Jul 2016 11:01:56 +0200 Subject: [PATCH] ecryptfs: fix kernel bug introduced in 4.4.14 Introduced by mainline commit 2f36db7 Patch is from http://www.spinics.net/lists/stable/msg137350.html Fixes #16766 --- .../linux/kernel/ecryptfs-fix-mmap-bug.patch | 20 +++++++++++++++++++ pkgs/os-specific/linux/kernel/patches.nix | 4 ++++ pkgs/top-level/all-packages.nix | 1 + 3 files changed, 25 insertions(+) create mode 100644 pkgs/os-specific/linux/kernel/ecryptfs-fix-mmap-bug.patch diff --git a/pkgs/os-specific/linux/kernel/ecryptfs-fix-mmap-bug.patch b/pkgs/os-specific/linux/kernel/ecryptfs-fix-mmap-bug.patch new file mode 100644 index 00000000000..7f94669a9f4 --- /dev/null +++ b/pkgs/os-specific/linux/kernel/ecryptfs-fix-mmap-bug.patch @@ -0,0 +1,20 @@ +Signed-off-by: Tyler Hicks +Tested-by: Tyler Hicks # 4.4.y, 3.18.y +Cc: # 4.5- +--- + fs/ecryptfs/kthread.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c +index e818f5a..b9faeab 100644 +--- a/fs/ecryptfs/kthread.c ++++ b/fs/ecryptfs/kthread.c +@@ -171,7 +171,7 @@ int ecryptfs_privileged_open(struct file **lower_file, + goto out; + } + have_file: +- if ((*lower_file)->f_op->mmap == NULL) { ++ if ((*lower_file)->f_op->mmap == NULL && !d_is_dir(lower_dentry)) { + fput(*lower_file); + *lower_file = NULL; + rc = -EMEDIUMTYPE; diff --git a/pkgs/os-specific/linux/kernel/patches.nix b/pkgs/os-specific/linux/kernel/patches.nix index 4f8d57acc17..7b2feaf84a8 100644 --- a/pkgs/os-specific/linux/kernel/patches.nix +++ b/pkgs/os-specific/linux/kernel/patches.nix @@ -148,4 +148,8 @@ rec { sha256 = "14rm1qr87p7a5prz8g5fwbpxzdp3ighj095x8rvhm8csm20wspyy"; }; }; + ecryptfs_fix_mmap_bug = + { name = "ecryptfs_fix_mmap_bug"; + patch = ./ecryptfs-fix-mmap-bug.patch; + }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4d40567f262..e982c9c4ee7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10954,6 +10954,7 @@ in [ kernelPatches.bridge_stp_helper kernelPatches.qat_common_Makefile kernelPatches.hiddev_CVE_2016_5829 + kernelPatches.ecryptfs_fix_mmap_bug ] ++ lib.optionals ((platform.kernelArch or null) == "mips") [ kernelPatches.mips_fpureg_emu