Make the inode argument of the inode_getsecurity hook non-const so that we can use it to revalidate invalid security labels.
Unified · Split
| @@ -1413,7 +1413,7 @@ union security_list_options { · 1412 unmodified lines | |||
| 1413 | int (*inode_removexattr)(struct dentry *dentry, const char *name); | 1413 | int (*inode_removexattr)(struct dentry *dentry, const char *name); |
| 1414 | int (*inode_need_killpriv)(struct dentry *dentry); | 1414 | int (*inode_need_killpriv)(struct dentry *dentry); |
| 1415 | int (*inode_killpriv)(struct dentry *dentry); | 1415 | int (*inode_killpriv)(struct dentry *dentry); |
| 1416 | int (*inode_getsecurity)(const struct inode *inode, const char *name, | 1416 | int (*inode_getsecurity)(struct inode *inode, const char *name, |
| 1417 | void **buffer, bool alloc); | 1417 | void **buffer, bool alloc); |
| 1418 | int (*inode_setsecurity)(struct inode *inode, const char *name, | 1418 | int (*inode_setsecurity)(struct inode *inode, const char *name, |
| 1419 | const void *value, size_t size, | 1419 | const void *value, size_t size, |
| @@ -270,7 +270,7 @@ int security_inode_listxattr(struct dentry *dentry); · 269 unmodified lines | |||
| 270 | int security_inode_removexattr(struct dentry *dentry, const char *name); | 270 | int security_inode_removexattr(struct dentry *dentry, const char *name); |
| 271 | int security_inode_need_killpriv(struct dentry *dentry); | 271 | int security_inode_need_killpriv(struct dentry *dentry); |
| 272 | int security_inode_killpriv(struct dentry *dentry); | 272 | int security_inode_killpriv(struct dentry *dentry); |
| 273 | int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc); | 273 | int security_inode_getsecurity(struct inode *inode, const char *name, void **buffer, bool alloc); |
| 274 | int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags); | 274 | int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags); |
| 275 | int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size); | 275 | int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size); |
| 276 | void security_inode_getsecid(const struct inode *inode, u32 *secid); | 276 | void security_inode_getsecid(const struct inode *inode, u32 *secid); |
| @@ -719,7 +719,7 @@ static inline int security_inode_killpriv(struct dentry *dentry) · 442 unmodified lines | |||
| 719 | return cap_inode_killpriv(dentry); | 719 | return cap_inode_killpriv(dentry); |
| 720 | } | 720 | } |
| 721 | 721 | ||
| 722 | static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc) | 722 | static inline int security_inode_getsecurity(struct inode *inode, const char *name, void **buffer, bool alloc) |
| 723 | { | 723 | { |
| 724 | return -EOPNOTSUPP; | 724 | return -EOPNOTSUPP; |
| 725 | } | 725 | } |
| @@ -697,7 +697,7 @@ int security_inode_killpriv(struct dentry *dentry) · 696 unmodified lines | |||
| 697 | return call_int_hook(inode_killpriv, 0, dentry); | 697 | return call_int_hook(inode_killpriv, 0, dentry); |
| 698 | } | 698 | } |
| 699 | 699 | ||
| 700 | int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc) | 700 | int security_inode_getsecurity(struct inode *inode, const char *name, void **buffer, bool alloc) |
| 701 | { | 701 | { |
| 702 | if (unlikely(IS_PRIVATE(inode))) | 702 | if (unlikely(IS_PRIVATE(inode))) |
| 703 | return -EOPNOTSUPP; | 703 | return -EOPNOTSUPP; |
| @@ -3108,7 +3108,7 @@ static int selinux_inode_removexattr(struct dentry *dentry, const char *name) · 3107 unmodified lines | |||
| 3108 | * | 3108 | * |
| 3109 | * Permission check is handled by selinux_inode_getxattr hook. | 3109 | * Permission check is handled by selinux_inode_getxattr hook. |
| 3110 | */ | 3110 | */ |
| 3111 | static int selinux_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc) | 3111 | static int selinux_inode_getsecurity(struct inode *inode, const char *name, void **buffer, bool alloc) |
| 3112 | { | 3112 | { |
| 3113 | u32 size; | 3113 | u32 size; |
| 3114 | int error; | 3114 | int error; |
| @@ -1465,7 +1465,7 @@ static int smack_inode_removexattr(struct dentry *dentry, const char *name) · 1464 unmodified lines | |||
| 1465 | * | 1465 | * |
| 1466 | * Returns the size of the attribute or an error code | 1466 | * Returns the size of the attribute or an error code |
| 1467 | */ | 1467 | */ |
| 1468 | static int smack_inode_getsecurity(const struct inode *inode, | 1468 | static int smack_inode_getsecurity(struct inode *inode, |
| 1469 | const char *name, void **buffer, | 1469 | const char *name, void **buffer, |
| 1470 | bool alloc) | 1470 | bool alloc) |
| 1471 | { | 1471 | { |