• Christian Brauner's avatar
    binderfs: prevent renaming the control dentry · e98e6fa1
    Christian Brauner authored
    - make binderfs control dentry immutable:
      We don't allow to unlink it since it is crucial for binderfs to be
      useable but if we allow to rename it we make the unlink trivial to
      bypass. So prevent renaming too and simply treat the control dentry as
      immutable.
    
    - add is_binderfs_control_device() helper:
      Take the opportunity and turn the check for the control dentry into a
      separate helper is_binderfs_control_device() since it's now used in two
      places.
    
    - simplify binderfs_rename():
      Instead of hand-rolling our custom version of simple_rename() just dumb
      the whole function down to first check whether we're trying to rename the
      control dentry. If we do EPERM the caller and if not call simple_rename().
    Suggested-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: default avatarChristian Brauner <christian@brauner.io>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    e98e6fa1
binderfs.c 14.4 KB