• R/O
  • SSH
  • HTTPS

akari: 提交


Commit MetaInfo

修訂686 (tree)
時間2022-05-25 22:50:48
作者kumaneko

Log Message

(empty log message)

Change Summary

差異

--- trunk/akari/lsm-4.12.c (revision 685)
+++ trunk/akari/lsm-4.12.c (revision 686)
@@ -441,6 +441,7 @@
441441 return ccs_symlink_permission(dentry, dir->mnt, old_name);
442442 }
443443
444+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
444445 /**
445446 * ccs_path_rename - Check permission for rename().
446447 *
@@ -448,6 +449,7 @@
448449 * @old_dentry: Pointer to "struct dentry".
449450 * @new_dir: Pointer to "struct path".
450451 * @new_dentry: Pointer to "struct dentry".
452+ * @flags: Rename flags.
451453 *
452454 * Returns 0 on success, negative value otherwise.
453455 */
@@ -454,10 +456,36 @@
454456 static int ccs_path_rename(const struct path *old_dir,
455457 struct dentry *old_dentry,
456458 const struct path *new_dir,
459+ struct dentry *new_dentry,
460+ const unsigned int flags)
461+{
462+ if (flags & RENAME_EXCHANGE) {
463+ const int err = ccs_rename_permission(new_dentry, old_dentry, old_dir->mnt);
464+
465+ if (err)
466+ return err;
467+ }
468+ return ccs_rename_permission(old_dentry, new_dentry, old_dir->mnt);
469+}
470+#else
471+/**
472+ * ccs_path_rename - Check permission for rename().
473+ *
474+ * @old_dir: Pointer to "struct path".
475+ * @old_dentry: Pointer to "struct dentry".
476+ * @new_dir: Pointer to "struct path".
477+ * @new_dentry: Pointer to "struct dentry".
478+ *
479+ * Returns 0 on success, negative value otherwise.
480+ */
481+static int ccs_path_rename(const struct path *old_dir,
482+ struct dentry *old_dentry,
483+ const struct path *new_dir,
457484 struct dentry *new_dentry)
458485 {
459486 return ccs_rename_permission(old_dentry, new_dentry, old_dir->mnt);
460487 }
488+#endif
461489
462490 /**
463491 * ccs_path_link - Check permission for link().
Show on old repository browser