Skip to content

Instantly share code, notes, and snippets.

@joanbm
Created August 16, 2020 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joanbm/9e20b3842bb336379eccc12410901e37 to your computer and use it in GitHub Desktop.
Save joanbm/9e20b3842bb336379eccc12410901e37 to your computer and use it in GitHub Desktop.
Broadcom wireless driver patch for Linux 5.9-rc1
From e5630a5ff6de417f0df7cfb14fe9434487f3d815 Mon Sep 17 00:00:00 2001
From: Joan Bruguera <joanbrugueram@gmail.com>
Date: Fri, 14 Aug 2020 00:38:47 +0200
Subject: [PATCH] Fix build for Linux 5.9-rc1
See also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=428e2976a5bf7e7f5554286d7a5a33b8147b106a
Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
---
src/wl/sys/wl_linux.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
index 0d05100..4be2189 100644
--- a/src/wl/sys/wl_linux.c
+++ b/src/wl/sys/wl_linux.c
@@ -1643,7 +1643,11 @@ wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
goto done2;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
if (segment_eq(get_fs(), KERNEL_DS))
+#else
+ if (uaccess_kernel())
+#endif
buf = ioc.buf;
else if (ioc.buf) {
--
2.28.0
@antoineco
Copy link

Thanks for this patch! 🙌 I just stumbled upon it while looking for a way to solve antoineco/broadcom-wl#16.

Was this bug reported anywhere? I couldn't find any bug tracker mentioning it.

@joanbm
Copy link
Author

joanbm commented Sep 10, 2020

Hi! No problem, glad it helped 🙂.

I didn't report any bug anywhere... Eli Schwartz from Arch Linux told me that the Broadcom upstream is 'dead', so I don't think there's anywhere official to report it, and since Linux 5.9 is still in release candidate and I don't think any distribution packages it, so they likely don't really care at this point. I guess most distributions will just patch it independently once the final 5.9 kernel is released and they start to package it.

@antoineco
Copy link

It is indeed unmaintained since 2015. I'll see if I can propagate that to the Arch bug tracker with a reference to your fix maybe, unless you're already on it.

@joanbm
Copy link
Author

joanbm commented Sep 11, 2020

It is indeed unmaintained since 2015. I'll see if I can propagate that to the Arch bug tracker with a reference to your fix maybe, unless you're already on it.

So far I haven't submitted anything.

@joanbm
Copy link
Author

joanbm commented Sep 13, 2020

BTW, in case someone is interested, I posted an alternative, more complex patch on https://gist.github.com/joanbm/5c640ac074d27fd1d82c74a5b67a1290 , which not only fixes Linux 5.9, but should be a more long-term fix since the kernel devs. seem to eventually want to get rid of the get_fs/set_fs/uaccess_kernel functions entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment