summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-11-29 12:41:33 +0100
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-11-29 12:41:33 +0100
commit0b267633e1648ef0ddc9fce9c22ca6300091cceb (patch)
treead4ae3a61f7d1b84feef89fbbe38e1563f2e0e13
parent764817448244310dd0ff2df7f01799761f02c236 (diff)
Add conditional build for kernels after 5.11
The function fcheck_files() is replaced by files_lookup_fd_rcu() on kernel version > 5.11.0 Bug-AGL: SPEC-4834 Change-Id: Ie4adb383252a35066d1ed3be1caad29883503af5 Signed-off-by: Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com>
-rw-r--r--loopback_driver.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/loopback_driver.c b/loopback_driver.c
index 452726c..950b2cb 100644
--- a/loopback_driver.c
+++ b/loopback_driver.c
@@ -65,6 +65,7 @@
#include <linux/pagemap.h>
#include <linux/delay.h>
+#include <linux/version.h>
/* Features */
MODULE_LICENSE("GPL v2");
@@ -1165,8 +1166,11 @@ static long loopback_ioctl(struct file *file,
userspace_task = pid_task(find_vpid(efd_data.pid), PIDTYPE_PID);
rcu_read_lock();
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,11,0)
efd_file = files_lookup_fd_rcu(userspace_task->files, efd_data.efd[0]);
+#else
rcu_read_unlock();
+#endif
efd_ctx = eventfd_ctx_fileget(efd_file);
if (!efd_ctx)