]> git.pld-linux.org Git - packages/wl.git/blame - kernel-5.10.patch
- rel 19
[packages/wl.git] / kernel-5.10.patch
CommitLineData
c90561b2
JR
1diff -urNp -x '*.orig' wl-6.30.223.271.org/src/wl/sys/wl_cfg80211_hybrid.c wl-6.30.223.271/src/wl/sys/wl_cfg80211_hybrid.c
2--- wl-6.30.223.271.org/src/wl/sys/wl_cfg80211_hybrid.c 2021-02-25 20:01:39.220996979 +0100
3+++ wl-6.30.223.271/src/wl/sys/wl_cfg80211_hybrid.c 2021-02-25 20:01:39.354330631 +0100
4@@ -41,6 +41,7 @@
c504579c
JR
5 #include <wlioctl.h>
6 #include <proto/802.11.h>
7 #include <wl_cfg80211_hybrid.h>
8+#include <wl_linux.h>
9
10 #define EVENT_TYPE(e) dtoh32((e)->event_type)
11 #define EVENT_FLAGS(e) dtoh16((e)->flags)
c90561b2 12@@ -449,30 +450,8 @@ static void key_endian_to_host(struct wl
c504579c
JR
13 static s32
14 wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
15 {
16- struct ifreq ifr;
17- struct wl_ioctl ioc;
18- mm_segment_t fs;
19- s32 err = 0;
20-
21 BUG_ON(len < sizeof(int));
22-
23- memset(&ioc, 0, sizeof(ioc));
24- ioc.cmd = cmd;
25- ioc.buf = arg;
26- ioc.len = len;
27- strcpy(ifr.ifr_name, dev->name);
28- ifr.ifr_data = (caddr_t)&ioc;
29-
30- fs = get_fs();
31- set_fs(get_ds());
32-#if defined(WL_USE_NETDEV_OPS)
33- err = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
34-#else
35- err = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
36-#endif
37- set_fs(fs);
38-
39- return err;
40+ return wlc_ioctl_internal(dev, cmd, arg, len);
41 }
42
c90561b2
JR
43 static s32
44diff -urNp -x '*.orig' wl-6.30.223.271.org/src/wl/sys/wl_iw.c wl-6.30.223.271/src/wl/sys/wl_iw.c
45--- wl-6.30.223.271.org/src/wl/sys/wl_iw.c 2015-09-19 00:47:15.000000000 +0200
46+++ wl-6.30.223.271/src/wl/sys/wl_iw.c 2021-02-25 20:01:39.354330631 +0100
c504579c
JR
47@@ -37,6 +37,7 @@ typedef const struct si_pub si_t;
48
49 #include <wl_dbg.h>
50 #include <wl_iw.h>
51+#include <wl_linux.h>
52
53 extern bool wl_iw_conn_status_str(uint32 event_type, uint32 status,
54 uint32 reason, char* stringBuf, uint buflen);
c90561b2 55@@ -103,29 +104,7 @@ dev_wlc_ioctl(
c504579c
JR
56 int len
57 )
58 {
59- struct ifreq ifr;
60- wl_ioctl_t ioc;
61- mm_segment_t fs;
62- int ret;
63-
64- memset(&ioc, 0, sizeof(ioc));
65- ioc.cmd = cmd;
66- ioc.buf = arg;
67- ioc.len = len;
68-
69- strcpy(ifr.ifr_name, dev->name);
70- ifr.ifr_data = (caddr_t) &ioc;
71-
72- fs = get_fs();
73- set_fs(get_ds());
74-#if defined(WL_USE_NETDEV_OPS)
75- ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
76-#else
77- ret = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
78-#endif
79- set_fs(fs);
80-
81- return ret;
82+ return wlc_ioctl_internal(dev, cmd, arg, len);
83 }
84
85 static int
c90561b2
JR
86diff -urNp -x '*.orig' wl-6.30.223.271.org/src/wl/sys/wl_linux.c wl-6.30.223.271/src/wl/sys/wl_linux.c
87--- wl-6.30.223.271.org/src/wl/sys/wl_linux.c 2021-02-25 20:01:39.220996979 +0100
88+++ wl-6.30.223.271/src/wl/sys/wl_linux.c 2021-02-25 20:01:39.354330631 +0100
89@@ -1662,10 +1662,7 @@ wl_ioctl(struct net_device *dev, struct
c504579c
JR
90 goto done2;
91 }
92
93- if (segment_eq(get_fs(), KERNEL_DS))
94- buf = ioc.buf;
95-
96- else if (ioc.buf) {
97+ if (ioc.buf) {
98 if (!(buf = (void *) MALLOC(wl->osh, MAX(ioc.len, WLC_IOCTL_MAXLEN)))) {
99 bcmerror = BCME_NORESOURCE;
100 goto done2;
c90561b2 101@@ -1686,7 +1683,7 @@ wl_ioctl(struct net_device *dev, struct
c504579c
JR
102 WL_UNLOCK(wl);
103
104 done1:
105- if (ioc.buf && (ioc.buf != buf)) {
106+ if (ioc.buf) {
107 if (copy_to_user(ioc.buf, buf, ioc.len))
108 bcmerror = BCME_BADADDR;
109 MFREE(wl->osh, buf, MAX(ioc.len, WLC_IOCTL_MAXLEN));
c90561b2 110@@ -1696,6 +1693,39 @@ done2:
c504579c
JR
111 ASSERT(VALID_BCMERROR(bcmerror));
112 if (bcmerror != 0)
113 wl->pub->bcmerror = bcmerror;
114+ return (OSL_ERROR(bcmerror));
115+}
116+
117+int
118+wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len)
119+{
120+ wl_info_t *wl;
121+ wl_if_t *wlif;
122+ int bcmerror;
123+
124+ if (!dev)
125+ return -ENETDOWN;
126+
127+ wl = WL_INFO(dev);
128+ wlif = WL_DEV_IF(dev);
129+ if (wlif == NULL || wl == NULL || wl->dev == NULL)
130+ return -ENETDOWN;
131+
132+ bcmerror = 0;
133+
134+ WL_TRACE(("wl%d: wlc_ioctl_internal: cmd 0x%x\n", wl->pub->unit, cmd));
135+
136+ WL_LOCK(wl);
137+ if (!capable(CAP_NET_ADMIN)) {
138+ bcmerror = BCME_EPERM;
139+ } else {
140+ bcmerror = wlc_ioctl(wl->wlc, cmd, buf, len, wlif->wlcif);
141+ }
142+ WL_UNLOCK(wl);
143+
144+ ASSERT(VALID_BCMERROR(bcmerror));
145+ if (bcmerror != 0)
146+ wl->pub->bcmerror = bcmerror;
147 return (OSL_ERROR(bcmerror));
148 }
149
c90561b2
JR
150diff -urNp -x '*.orig' wl-6.30.223.271.org/src/wl/sys/wl_linux.h wl-6.30.223.271/src/wl/sys/wl_linux.h
151--- wl-6.30.223.271.org/src/wl/sys/wl_linux.h 2015-09-19 00:47:15.000000000 +0200
152+++ wl-6.30.223.271/src/wl/sys/wl_linux.h 2021-02-25 20:01:39.354330631 +0100
c504579c
JR
153@@ -22,6 +22,7 @@
154 #define _wl_linux_h_
155
156 #include <wlc_types.h>
157+#include <wlc_pub.h>
158
159 typedef struct wl_timer {
160 struct timer_list timer;
161@@ -187,6 +188,7 @@ extern irqreturn_t wl_isr(int irq, void
162 extern int __devinit wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
163 extern void wl_free(wl_info_t *wl);
164 extern int wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
165+extern int wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len);
166 extern struct net_device * wl_netdev_get(wl_info_t *wl);
167
168 #endif
c90561b2
JR
169diff -urNp -x '*.orig' wl-6.30.223.271.org/src/wl/sys/wlc_pub.h wl-6.30.223.271/src/wl/sys/wlc_pub.h
170--- wl-6.30.223.271.org/src/wl/sys/wlc_pub.h 2015-09-19 00:47:15.000000000 +0200
171+++ wl-6.30.223.271/src/wl/sys/wlc_pub.h 2021-02-25 20:01:39.354330631 +0100
c504579c
JR
172@@ -24,6 +24,7 @@
173
174 #include <wlc_types.h>
175 #include <wlc_utils.h>
176+#include <siutils.h>
177 #include "proto/802.11.h"
178 #include "proto/bcmevent.h"
179
This page took 0.176432 seconds and 4 git commands to generate.