10-fix-build-on-kernel-5.15.52-or-higher.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. From 98bc509f92cccedd7d51d5ebadc424e2d7f5cbb4 Mon Sep 17 00:00:00 2001
  2. From: Chukun Pan <[email protected]>
  3. Date: Tue, 5 Jul 2022 15:20:10 +0800
  4. Subject: [PATCH] ksmbd: fixes build on kernel 5.15.52 or higher
  5. The 5.15.52 kernel downported two commits "fs: remove unused low-level
  6. mapping helpers" and "fs: use low-level mapping helpers", which broken
  7. the compilation[1]. This commit fixed it.
  8. 1. https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.52
  9. Signed-off-by: Chukun Pan <[email protected]>
  10. Signed-off-by: Namjae Jeon <[email protected]>
  11. ---
  12. smbacl.c | 6 ++++--
  13. smbacl.h | 6 ++++--
  14. 2 files changed, 8 insertions(+), 4 deletions(-)
  15. diff --git a/smbacl.c b/smbacl.c
  16. index 275e357..19c682a 100644
  17. --- a/smbacl.c
  18. +++ b/smbacl.c
  19. @@ -281,7 +281,8 @@ static int sid_to_id(struct user_namespace *user_ns,
  20. uid_t id;
  21. id = le32_to_cpu(psid->sub_auth[psid->num_subauth - 1]);
  22. -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
  23. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) || \
  24. + (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 52) && LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0))
  25. uid = mapped_kuid_user(user_ns, &init_user_ns, KUIDT_INIT(id));
  26. #else
  27. /*
  28. @@ -304,7 +305,8 @@ static int sid_to_id(struct user_namespace *user_ns,
  29. gid_t id;
  30. id = le32_to_cpu(psid->sub_auth[psid->num_subauth - 1]);
  31. -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
  32. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) || \
  33. + (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 52) && LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0))
  34. gid = mapped_kgid_user(user_ns, &init_user_ns, KGIDT_INIT(id));
  35. #else
  36. /*
  37. diff --git a/smbacl.h b/smbacl.h
  38. index f2bcdb4..7368bf4 100644
  39. --- a/smbacl.h
  40. +++ b/smbacl.h
  41. @@ -221,7 +221,8 @@ static inline uid_t posix_acl_uid_translate(struct user_namespace *mnt_userns,
  42. kuid_t kuid;
  43. /* If this is an idmapped mount, apply the idmapping. */
  44. -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
  45. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) || \
  46. + (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 52) && LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0))
  47. kuid = mapped_kuid_fs(mnt_userns, &init_user_ns, pace->e_uid);
  48. #else
  49. kuid = kuid_into_mnt(mnt_userns, pace->e_uid);
  50. @@ -241,7 +242,8 @@ static inline gid_t posix_acl_gid_translate(struct user_namespace *mnt_userns,
  51. kgid_t kgid;
  52. /* If this is an idmapped mount, apply the idmapping. */
  53. -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
  54. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) || \
  55. + (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 52) && LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0))
  56. kgid = mapped_kgid_fs(mnt_userns, &init_user_ns, pace->e_gid);
  57. #else
  58. kgid = kgid_into_mnt(mnt_userns, pace->e_gid);
  59. --
  60. 2.36.1