Skip to content

Commit ef435c4

Browse files
committed
The
ofault function is only prioritized in higher versions
1 parent 9886aa7 commit ef435c4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

kernel/patch/common/utils.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ int __must_check compat_copy_to_user(void __user *to, const void *from, int n)
7575
{
7676
int cplen = 0;
7777

78-
if (kfunc(xt_data_to_user)) {
78+
if (kfunc(xt_data_to_user) && kver > VERSION(6, 7, 0) ) {
7979
// xt_data_to_user, xt_obj_to_user
8080
cplen = compat_xt_data_copy_to_user(to, from, n);
8181
if (!cplen) cplen = n;
@@ -98,8 +98,11 @@ KP_EXPORT_SYMBOL(compat_copy_to_user);
9898

9999
long compat_strncpy_from_user(char *dest, const char __user *src, long count)
100100
{
101-
kfunc_call(strncpy_from_user_nofault, dest, src, count);
102-
kfunc_call(strncpy_from_unsafe_user, dest, src, count);
101+
if (kver > VERSION(6, 7, 0)){
102+
kfunc_call(strncpy_from_user_nofault, dest, src, count);
103+
kfunc_call(strncpy_from_unsafe_user, dest, src, count);
104+
}
105+
103106
if (kfunc(strncpy_from_user)) {
104107
long rc = kfunc(strncpy_from_user)(dest, src, count);
105108
if (rc >= count) {
@@ -110,6 +113,7 @@ long compat_strncpy_from_user(char *dest, const char __user *src, long count)
110113
}
111114
return rc;
112115
}
116+
113117
return 0;
114118
}
115119
KP_EXPORT_SYMBOL(compat_strncpy_from_user);

0 commit comments

Comments
 (0)