Overview
broadcom-wl.changes
Changed
x
1
2
-------------------------------------------------------------------
3
+Fri Nov 13 07:45:38 UTC 2020 - manfred.h@gmx.net
4
+
5
+- Rebase broadcom-wl.linux-5.9.patch on Debian's patch
6
+ 17-Get-rid-of-get_fs-set_fs-calls.patch to get rid of all get_fd
7
+ and set_fd calls
8
+
9
+-------------------------------------------------------------------
10
Sat Aug 22 13:29:31 UTC 2020 - manfred.h@gmx.net
11
12
- Add broadcom-wl.linux-5.9.patch as Patch18
13
broadcom-wl.linux-5.9.patch
Changed
214
1
2
+From: Joan Bruguera <joanbrugueram@gmail.com>
3
+Date: Sun, 13 Sep 2020 07:33:32 +0200
4
+Subject: Get rid of get_fs/set_fs calls in Broadcom WL driver.
5
+Origin: https://gist.github.com/joanbm/5c640ac074d27fd1d82c74a5b67a1290
6
+
7
+Fixes linux-next where get_fs/set_fs is already removed for some architectures.
8
+
9
+NB: Some checks in wlc_ioctl_internal are likely superfluous,
10
+ but I'm not familiar enough with the driver to remove them with confidence.
11
+
12
+See also: https://lwn.net/Articles/722267/
13
+ https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/arch/x86/include/asm/uaccess.h?h=next-20200911&id=47058bb54b57962b3958a936ddbc59355e4c5504
14
+ https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/include/linux/uaccess.h?h=next-20200911&id=5e6e9852d6f76e01b2e6803c74258afa5b432bc5
15
+
16
+Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
17
+---
18
+ src/wl/sys/wl_cfg80211_hybrid.c | 29 ++-----------------------
19
+ src/wl/sys/wl_iw.c | 25 ++--------------------
20
+ src/wl/sys/wl_linux.c | 40 ++++++++++++++++++++++++++++++-----
21
+ src/wl/sys/wl_linux.h | 2 ++
22
+ src/wl/sys/wlc_pub.h | 1 +
23
+ 5 files changed, 42 insertions(+), 55 deletions(-)
24
+
25
+diff -rup a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
26
+--- a/src/wl/sys/wl_cfg80211_hybrid.c 2020-11-13 08:38:56.883599679 +0100
27
++++ b/src/wl/sys/wl_cfg80211_hybrid.c 2020-11-13 08:42:07.944320760 +0100
28
+@@ -38,6 +38,7 @@
29
+ #include <wlioctl.h>
30
+ #include <proto/802.11.h>
31
+ #include <wl_cfg80211_hybrid.h>
32
++#include <wl_linux.h>
33
+
34
+ #define EVENT_TYPE(e) dtoh32((e)->event_type)
35
+ #define EVENT_FLAGS(e) dtoh16((e)->flags)
36
+@@ -436,30 +437,8 @@ static void key_endian_to_host(struct wl
37
+ static s32
38
+ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
39
+ {
40
+- struct ifreq ifr;
41
+- struct wl_ioctl ioc;
42
+- mm_segment_t fs;
43
+- s32 err = 0;
44
+-
45
+ BUG_ON(len < sizeof(int));
46
+-
47
+- memset(&ioc, 0, sizeof(ioc));
48
+- ioc.cmd = cmd;
49
+- ioc.buf = arg;
50
+- ioc.len = len;
51
+- strcpy(ifr.ifr_name, dev->name);
52
+- ifr.ifr_data = (caddr_t)&ioc;
53
+-
54
+- fs = get_fs();
55
+- set_fs(get_ds());
56
+-#if defined(WL_USE_NETDEV_OPS)
57
+- err = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
58
+-#else
59
+- err = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
60
+-#endif
61
+- set_fs(fs);
62
+-
63
+- return err;
64
++ return wlc_ioctl_internal(dev, cmd, arg, len);
65
+ }
66
+
67
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
68
+diff -rup a/src/wl/sys/wl_iw.c b/src/wl/sys/wl_iw.c
69
+--- a/src/wl/sys/wl_iw.c 2020-11-13 08:38:56.891599715 +0100
70
++++ b/src/wl/sys/wl_iw.c 2020-11-13 08:40:14.803914270 +0100
71
+@@ -37,6 +37,7 @@ typedef const struct si_pub si_t;
72
+
73
+ #include <wl_dbg.h>
74
+ #include <wl_iw.h>
75
++#include <wl_linux.h>
76
+
77
+ extern bool wl_iw_conn_status_str(uint32 event_type, uint32 status,
78
+ uint32 reason, char* stringBuf, uint buflen);
79
+@@ -106,29 +107,7 @@ dev_wlc_ioctl(
80
+ int len
81
+ )
82
+ {
83
+- struct ifreq ifr;
84
+- wl_ioctl_t ioc;
85
+- mm_segment_t fs;
86
+- int ret;
87
+-
88
+- memset(&ioc, 0, sizeof(ioc));
89
+- ioc.cmd = cmd;
90
+- ioc.buf = arg;
91
+- ioc.len = len;
92
+-
93
+- strcpy(ifr.ifr_name, dev->name);
94
+- ifr.ifr_data = (caddr_t) &ioc;
95
+-
96
+- fs = get_fs();
97
+- set_fs(get_ds());
98
+-#if defined(WL_USE_NETDEV_OPS)
99
+- ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
100
+-#else
101
+- ret = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
102
+-#endif
103
+- set_fs(fs);
104
+-
105
+- return ret;
106
++ return wlc_ioctl_internal(dev, cmd, arg, len);
107
+ }
108
+
109
+ static int
110
diff -rup a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
111
---- a/src/wl/sys/wl_linux.c 2020-08-22 15:12:24.361468571 +0200
112
-+++ a/src/wl/sys/wl_linux.c 2020-08-22 15:16:21.546596569 +0200
113
-@@ -1649,7 +1649,11 @@ wl_ioctl(struct net_device *dev, struct
114
+--- a/src/wl/sys/wl_linux.c 2020-11-13 08:39:05.659639371 +0100
115
++++ b/src/wl/sys/wl_linux.c 2020-11-13 08:40:14.803914270 +0100
116
+@@ -1649,10 +1649,7 @@ wl_ioctl(struct net_device *dev, struct
117
goto done2;
118
}
119
120
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
121
-+ if (uaccess_kernel())
122
-+#else
123
- if (segment_eq(get_fs(), KERNEL_DS))
124
-+#endif
125
- buf = ioc.buf;
126
+- if (segment_eq(get_fs(), KERNEL_DS))
127
+- buf = ioc.buf;
128
+-
129
+- else if (ioc.buf) {
130
++ if (ioc.buf) {
131
+ if (!(buf = (void *) MALLOC(wl->osh, MAX(ioc.len, WLC_IOCTL_MAXLEN)))) {
132
+ bcmerror = BCME_NORESOURCE;
133
+ goto done2;
134
+@@ -1673,7 +1670,7 @@ wl_ioctl(struct net_device *dev, struct
135
+ WL_UNLOCK(wl);
136
+
137
+ done1:
138
+- if (ioc.buf && (ioc.buf != buf)) {
139
++ if (ioc.buf) {
140
+ if (copy_to_user(ioc.buf, buf, ioc.len))
141
+ bcmerror = BCME_BADADDR;
142
+ MFREE(wl->osh, buf, MAX(ioc.len, WLC_IOCTL_MAXLEN));
143
+@@ -1683,6 +1680,39 @@ done2:
144
+ ASSERT(VALID_BCMERROR(bcmerror));
145
+ if (bcmerror != 0)
146
+ wl->pub->bcmerror = bcmerror;
147
++ return (OSL_ERROR(bcmerror));
148
++}
149
++
150
++int
151
++wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len)
152
++{
153
++ wl_info_t *wl;
154
++ wl_if_t *wlif;
155
++ int bcmerror;
156
++
157
++ if (!dev)
158
++ return -ENETDOWN;
159
++
160
++ wl = WL_INFO(dev);
161
++ wlif = WL_DEV_IF(dev);
162
++ if (wlif == NULL || wl == NULL || wl->dev == NULL)
163
++ return -ENETDOWN;
164
++
165
++ bcmerror = 0;
166
++
167
++ WL_TRACE(("wl%d: wlc_ioctl_internal: cmd 0x%x\n", wl->pub->unit, cmd));
168
++
169
++ WL_LOCK(wl);
170
++ if (!capable(CAP_NET_ADMIN)) {
171
++ bcmerror = BCME_EPERM;
172
++ } else {
173
++ bcmerror = wlc_ioctl(wl->wlc, cmd, buf, len, wlif->wlcif);
174
++ }
175
++ WL_UNLOCK(wl);
176
++
177
++ ASSERT(VALID_BCMERROR(bcmerror));
178
++ if (bcmerror != 0)
179
++ wl->pub->bcmerror = bcmerror;
180
+ return (OSL_ERROR(bcmerror));
181
+ }
182
+
183
+diff -rup a/src/wl/sys/wl_linux.h b/src/wl/sys/wl_linux.h
184
+--- a/src/wl/sys/wl_linux.h 2015-09-19 00:47:30.000000000 +0200
185
++++ b/src/wl/sys/wl_linux.h 2020-11-13 08:40:14.803914270 +0100
186
+@@ -22,6 +22,7 @@
187
+ #define _wl_linux_h_
188
+
189
+ #include <wlc_types.h>
190
++#include <wlc_pub.h>
191
+
192
+ typedef struct wl_timer {
193
+ struct timer_list timer;
194
+@@ -187,6 +188,7 @@ extern irqreturn_t wl_isr(int irq, void
195
+ extern int __devinit wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
196
+ extern void wl_free(wl_info_t *wl);
197
+ extern int wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
198
++extern int wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len);
199
+ extern struct net_device * wl_netdev_get(wl_info_t *wl);
200
+
201
+ #endif
202
+diff -rup a/src/wl/sys/wlc_pub.h b/src/wl/sys/wlc_pub.h
203
+--- a/src/wl/sys/wlc_pub.h 2015-09-19 00:47:30.000000000 +0200
204
++++ b/src/wl/sys/wlc_pub.h 2020-11-13 08:40:14.803914270 +0100
205
+@@ -24,6 +24,7 @@
206
+
207
+ #include <wlc_types.h>
208
+ #include <wlc_utils.h>
209
++#include <siutils.h>
210
+ #include "proto/802.11.h"
211
+ #include "proto/bcmevent.h"
212
213
- else if (ioc.buf) {
214
Refresh
Refresh
Login required, please
login
or
signup
in order to comment
Request History
manfred.h created request over 4 years ago
- Rebase broadcom-wl.linux-5.9.patch on Debian's patch
17-Get-rid-of-get_fs-set_fs-calls.patch to get rid of all
get_fd and set_fd calls; this allows building for Linux
kernel version 5.10!
manfred.h accepted request over 4 years ago
Now that I'm maintainer of this package, approved based on confirmation from Ilgaz Öcal that it still works for him.