(empty log message)
@@ -441,6 +441,7 @@ | ||
441 | 441 | return ccs_symlink_permission(dentry, dir->mnt, old_name); |
442 | 442 | } |
443 | 443 | |
444 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) | |
444 | 445 | /** |
445 | 446 | * ccs_path_rename - Check permission for rename(). |
446 | 447 | * |
@@ -448,6 +449,7 @@ | ||
448 | 449 | * @old_dentry: Pointer to "struct dentry". |
449 | 450 | * @new_dir: Pointer to "struct path". |
450 | 451 | * @new_dentry: Pointer to "struct dentry". |
452 | + * @flags: Rename flags. | |
451 | 453 | * |
452 | 454 | * Returns 0 on success, negative value otherwise. |
453 | 455 | */ |
@@ -454,10 +456,36 @@ | ||
454 | 456 | static int ccs_path_rename(const struct path *old_dir, |
455 | 457 | struct dentry *old_dentry, |
456 | 458 | 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, | |
457 | 484 | struct dentry *new_dentry) |
458 | 485 | { |
459 | 486 | return ccs_rename_permission(old_dentry, new_dentry, old_dir->mnt); |
460 | 487 | } |
488 | +#endif | |
461 | 489 | |
462 | 490 | /** |
463 | 491 | * ccs_path_link - Check permission for link(). |