summarylogtreecommitdiffstats
path: root/0002-kernel-5.0.0-access_ok.patch
diff options
context:
space:
mode:
Diffstat (limited to '0002-kernel-5.0.0-access_ok.patch')
-rw-r--r--0002-kernel-5.0.0-access_ok.patch124
1 files changed, 124 insertions, 0 deletions
diff --git a/0002-kernel-5.0.0-access_ok.patch b/0002-kernel-5.0.0-access_ok.patch
new file mode 100644
index 000000000000..c65bdc457d2e
--- /dev/null
+++ b/0002-kernel-5.0.0-access_ok.patch
@@ -0,0 +1,124 @@
+--- npreal2.c.orig 2017-11-10 02:25:03.000000000 -0500
++++ npreal2.c 2019-03-10 21:28:04.465949059 -0400
+@@ -1317,19 +1317,25 @@ static int npreal_ioctl(struct tty_struc
+ return(retval);
+ tty_wait_until_sent(tty, 0);
+ npreal_send_break(info, arg ? arg*(HZ/10) : HZ/4);
+ return(0);
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0)
++#define compat_access_ok(u,v,w) access_ok(v,w)
++#else
++#define compat_access_ok(u,v,w) access_ok(u,v,w)
++#endif
++
+ case TIOCGSOFTCAR:
+- error = access_ok(VERIFY_WRITE, (void *)arg, sizeof(long))?0:-EFAULT;
++ error = compat_access_ok(VERIFY_WRITE, (void *)arg, sizeof(long))?0:-EFAULT;
+ if ( error )
+ return(error);
+ put_to_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long *)arg);
+ return 0;
+
+ case TIOCSSOFTCAR:
+- error = access_ok(VERIFY_READ, (void *)arg, sizeof(long))?0:-EFAULT;
++ error = compat_access_ok(VERIFY_READ, (void *)arg, sizeof(long))?0:-EFAULT;
+ if ( error )
+ return(error);
+ get_from_user(templ,(unsigned long *)arg);
+ arg = templ;
+ #if (LINUX_VERSION_CODE < VERSION_CODE(3,7,0))
+@@ -1340,25 +1346,25 @@ static int npreal_ioctl(struct tty_struc
+ (arg ? CLOCAL : 0));
+ #endif
+ return(0);
+
+ case TIOCGSERIAL:
+- error = access_ok(VERIFY_WRITE, (void *)arg,
++ error = compat_access_ok(VERIFY_WRITE, (void *)arg,
+ sizeof(struct serial_struct))?0:-EFAULT;
+ if ( error )
+ return(error);
+ return(npreal_get_serial_info(info, (struct serial_struct *)arg));
+
+ case TIOCSSERIAL:
+- error = access_ok(VERIFY_READ, (void *)arg,
++ error = compat_access_ok(VERIFY_READ, (void *)arg,
+ sizeof(struct serial_struct))?0:-EFAULT;
+ if ( error )
+ return(error);
+ return(npreal_set_serial_info(info, (struct serial_struct *)arg));
+
+ case TIOCSERGETLSR: /* Get line status register */
+- error = access_ok(VERIFY_WRITE, (void *)arg,
++ error = compat_access_ok(VERIFY_WRITE, (void *)arg,
+ sizeof(unsigned int))?0:-EFAULT;
+ if ( error )
+ return(error);
+ else
+ return(npreal_get_lsr_info(info, (unsigned int *)arg));
+@@ -1411,11 +1417,11 @@ static int npreal_ioctl(struct tty_struc
+ * Return: write counters to the user passed counter struct
+ * NB: both 1->0 and 0->1 transitions are counted except for
+ * RI where only 0->1 is counted.
+ */
+ case TIOCGICOUNT:
+- error = access_ok(VERIFY_WRITE, (void *)arg,
++ error = compat_access_ok(VERIFY_WRITE, (void *)arg,
+ sizeof(struct serial_icounter_struct))?0:-EFAULT;
+ if ( error )
+ return(error);
+ cnow = info->icount;
+ p_cuser = (struct serial_icounter_struct *)arg;
+@@ -3369,11 +3375,11 @@ npreal_net_ioctl (
+ }
+ if (nd->flag & NPREAL_NET_DO_SESSION_RECOVERY)
+ len = nd->do_session_recovery_len;
+ else
+ len = (int)nd->cmd_buffer[2] + 3;
+- rtn = access_ok( VERIFY_WRITE, (void *)arg, len)?0:-EFAULT;
++ rtn = compat_access_ok( VERIFY_WRITE, (void *)arg, len)?0:-EFAULT;
+ if ( rtn )
+ {
+ goto done;
+ }
+ if (copy_to_user( (void *)arg, (void *)nd->cmd_buffer,len ))
+@@ -3393,11 +3399,11 @@ npreal_net_ioctl (
+ if (size < 2)
+ goto done;
+ if (size > 84)
+ size = 84;
+
+- rtn = access_ok( VERIFY_READ, (void *)arg, size )?0:-EFAULT;
++ rtn = compat_access_ok( VERIFY_READ, (void *)arg, size )?0:-EFAULT;
+ if ( rtn )
+ {
+ goto done;
+ }
+ if (copy_from_user( (void *)rsp_buffer, (void *)arg,size))
+@@ -3518,11 +3524,11 @@ npreal_net_ioctl (
+ int status;
+
+ if (size != sizeof (status))
+ goto done;
+
+- rtn = access_ok( VERIFY_READ, (void *)arg, size )?0:-EFAULT;
++ rtn = compat_access_ok( VERIFY_READ, (void *)arg, size )?0:-EFAULT;
+ if ( rtn )
+ {
+ goto done;
+ }
+ status = (nd->flag & NPREAL_NET_TTY_INUSED) ? 1 : 0;
+@@ -3543,11 +3549,11 @@ npreal_net_ioctl (
+ break;
+
+ if (size != sizeof (struct server_setting_struct))
+ goto done;
+
+- rtn = access_ok( VERIFY_READ, (void *)arg, size )?0:-EFAULT;
++ rtn = compat_access_ok( VERIFY_READ, (void *)arg, size )?0:-EFAULT;
+ if ( rtn )
+ {
+ goto done;
+ }
+ if (copy_from_user( (void *)&settings, (void *)arg,size))