kdbus: Fix rwsem_release() for v5.5 or later kernel version 79/321379/1 tizen
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 19 Mar 2025 11:57:02 +0000 (20:57 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 19 Mar 2025 11:57:04 +0000 (20:57 +0900)
If CONFIG_DEBUG_LOCK_ALLOC is enabled for v5.5 or laster kernel
version, change of rwsem_release() causes build error.
To support v5.5 or later version, fix rwsem_release() to use proper
parameters with kernel version.

Change-Id: I2592cb5c266f8083797690289050e2996ec8823b
Ref: commit 5facae4f3549 ("locking/lockdep: Remove unused @nested argument from lock_release()")
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
kernel/kdbus/connection.c

index 8a9985bfe2665f25939eef918aae802b5ac44630..33699ab89175d163fb5def25ac1913618ea7607e 100644 (file)
@@ -12,6 +12,7 @@
  * your option) any later version.
  */
 
+#include <linux/version.h>
 #include <linux/audit.h>
 #include <linux/file.h>
 #include <linux/fs.h>
@@ -406,7 +407,11 @@ void kdbus_conn_release(struct kdbus_conn *conn)
                return;
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
+       rwsem_release(&conn->dep_map, _RET_IP_);
+#else
        rwsem_release(&conn->dep_map, 1, _RET_IP_);
+#endif
 #endif
 
        v = atomic_dec_return(&conn->active);
@@ -542,7 +547,11 @@ int kdbus_conn_disconnect(struct kdbus_conn *conn, bool ensure_queue_empty)
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
        lock_acquired(&conn->dep_map, _RET_IP_);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
+       rwsem_release(&conn->dep_map, _RET_IP_);
+#else
        rwsem_release(&conn->dep_map, 1, _RET_IP_);
+#endif
 #endif
 
        cancel_delayed_work_sync(&conn->work);