kernel: fix anon_get_inode_* compat
* Yes, we don't have fancy secure fd thing on older kernels. Signed-off-by: Faris <rissu.ntk@gmail.com>
This commit is contained in:
@@ -124,6 +124,10 @@ ifeq ($(shell grep -q "__poll_t" $(srctree)/include/linux/poll.h; echo $$?),1)
|
|||||||
ccflags-y += -DKSU_NEED_POLL_T_DEF
|
ccflags-y += -DKSU_NEED_POLL_T_DEF
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(shell grep -q "anon_inode_getfd_secure" $(srctree)/fs/anon_inodes.c; echo $$?),0)
|
||||||
|
ccflags-y += -DKSU_HAS_GETFD_SECURE
|
||||||
|
endif
|
||||||
|
|
||||||
# Checks Samsung
|
# Checks Samsung
|
||||||
ifeq ($(shell grep -q "CONFIG_KDP_CRED" $(srctree)/kernel/cred.c; echo $$?),0)
|
ifeq ($(shell grep -q "CONFIG_KDP_CRED" $(srctree)/kernel/cred.c; echo $$?),0)
|
||||||
ccflags-y += -DSAMSUNG_UH_DRIVER_EXIST
|
ccflags-y += -DSAMSUNG_UH_DRIVER_EXIST
|
||||||
|
|||||||
@@ -381,17 +381,22 @@ static int __do_get_wrapper_fd(void __user *arg, const char *anon_name)
|
|||||||
|
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
|
||||||
#define getfd_secure anon_inode_create_getfd
|
#define getfd_secure anon_inode_create_getfd
|
||||||
#else
|
#elif defined(KSU_HAS_GETFD_SECURE)
|
||||||
#define getfd_secure anon_inode_getfd_secure
|
#define getfd_secure anon_inode_getfd_secure
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef KSU_HAS_GETFD_SECURE
|
||||||
ret = getfd_secure(anon_name, &data->ops, data, f->f_flags, NULL);
|
ret = getfd_secure(anon_name, &data->ops, data, f->f_flags, NULL);
|
||||||
|
#else
|
||||||
|
ret = anon_inode_getfd(anon_name, &data->ops, data, f->f_flags);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
pr_err("ksu_fdwrapper: getfd failed: %d\n", ret);
|
pr_err("ksu_fdwrapper: getfd failed: %d\n", ret);
|
||||||
goto put_wrapper_data;
|
goto put_wrapper_data;
|
||||||
}
|
}
|
||||||
struct file *pf = fget(ret);
|
|
||||||
|
|
||||||
|
struct file *pf = fget(ret);
|
||||||
struct inode *wrapper_inode = file_inode(pf);
|
struct inode *wrapper_inode = file_inode(pf);
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) || \
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) || \
|
||||||
defined(KSU_OPTIONAL_SELINUX_INODE)
|
defined(KSU_OPTIONAL_SELINUX_INODE)
|
||||||
|
|||||||
Reference in New Issue
Block a user