summarylogtreecommitdiffstats
path: root/0003-kernel-5.0.0-dgrp_mon_ops-access_ok.patch
blob: afb052c9ae90de4ec8fb7fea7f552f791e5d9eb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
--- driver/mxuport/mx-uport.c.orig	2018-03-06 21:52:33.000000000 -0500
+++ driver/mxuport/mx-uport.c	2019-03-31 21:25:37.676299896 -0400
@@ -1055,10 +1055,16 @@ static void mxuport_set_termios (struct
 	mx_change_port_settings(mx_port, 0);
 
 	return;
 }
 
+#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
+
 /*
  *  mxuport_ioctl - I/O control function of driver
  *
  *	This function handles any ioctl calls to the driver.
  */
@@ -1183,17 +1189,17 @@ static int mxuport_ioctl (struct usb_ser
 			if (copy_to_user((void __user *)arg, &mx_port->icount, sizeof(mx_port->icount)))
 				return -EFAULT;
 			return 0;
 			
 		case TIOCGSOFTCAR:
-	        if(!access_ok(VERIFY_WRITE, (void *)arg, sizeof(unsigned int))) {
+	        if(!compat_access_ok(VERIFY_WRITE, (void *)arg, sizeof(unsigned int))) {
 		        return -EFAULT;
 			}
 			return put_user(C_CLOCAL(port->tty) ? 1 : 0, (unsigned int *)arg);
 
 		case TIOCSSOFTCAR:			
-	        if(!access_ok(VERIFY_READ, (void *)arg, sizeof(unsigned int))) {
+	        if(!compat_access_ok(VERIFY_READ, (void *)arg, sizeof(unsigned int))) {
 		        return -EFAULT;
 			}
 			if(get_user(arg, (unsigned int *)arg))
 			    return -EFAULT;
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0))  			
@@ -1412,11 +1418,11 @@ static int mxuport_ioctl (struct usb_ser
                (mx_serial->productid != MX_UPORT1250_PID) ||
                (mx_serial->productid != MX_UPORT1251_PID)) {
                 return -EINVAL;
 			}
 
-	        if(!access_ok(VERIFY_READ, (void *)arg, sizeof(int))) {
+	        if(!compat_access_ok(VERIFY_READ, (void *)arg, sizeof(int))) {
 		        return -EFAULT;
 			}
                     
             if(get_user(req_if, (int *)arg)) {
 		        return -EFAULT;
@@ -1438,11 +1444,11 @@ static int mxuport_ioctl (struct usb_ser
 				}
             }
             break;
     
         case MOXA_SET_SPECIAL_BAUD:
-	        if(!access_ok(VERIFY_READ, (void *)arg, sizeof(long)))
+	        if(!compat_access_ok(VERIFY_READ, (void *)arg, sizeof(long)))
 		        return -EFAULT;
 
             if(get_user(baud, (long *)arg))
 		        return -EFAULT;