Skip to content

Commit

Permalink
main/iwd: backport crash fix, patch_style=git
Browse files Browse the repository at this point in the history
  • Loading branch information
nekopsykose committed Oct 4, 2024
1 parent 9384279 commit 112c40f
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 103 deletions.
59 changes: 59 additions & 0 deletions main/iwd/patches/crash.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Patch-Source: https://git.kernel.org/pub/scm/network/wireless/iwd.git/commit/?id=b0a011d8f4aff5c24736eb1213e667aaad113c6a
--
From b0a011d8f4aff5c24736eb1213e667aaad113c6a Mon Sep 17 00:00:00 2001
From: James Prestwood <[email protected]>
Date: Thu, 3 Oct 2024 05:58:17 -0700
Subject: netdev: fix crash in the RSSI polling fallback workaround

Prior to adding the polling fallback this code path was only used for
signal level list notifications and netdev_rssi_polling_update() was
structured as such, where if the RSSI list feature existed there was
nothing to be done as the kernel handled the notifications.

For certain mediatek cards this is broken, hence why the fallback was
added. But netdev_rssi_polling_update() was never changed to take
this into account which bypassed the timer cleanup on disconnections
resulting in a crash when the timer fired after IWD was disconnected:

iwd: ++++++++ backtrace ++++++++
iwd: #0 0x7b5459642520 in /lib/x86_64-linux-gnu/libc.so.6
iwd: #1 0x7b54597aedf4 in /lib/x86_64-linux-gnu/libc.so.6
iwd: #2 0x49f82d in l_netlink_message_append() at ome/jprestwood/iwd/ell/netlink.c:825
iwd: #3 0x4a0c12 in l_genl_msg_append_attr() at ome/jprestwood/iwd/ell/genl.c:1522
iwd: #4 0x405c61 in netdev_rssi_poll() at ome/jprestwood/iwd/src/netdev.c:764
iwd: #5 0x49cce4 in timeout_callback() at ome/jprestwood/iwd/ell/timeout.c:70
iwd: #6 0x49c2ed in l_main_iterate() at ome/jprestwood/iwd/ell/main.c:455 (discriminator 2)
iwd: #7 0x49c3bc in l_main_run() at ome/jprestwood/iwd/ell/main.c:504
iwd: #8 0x49c5f0 in l_main_run_with_signal() at ome/jprestwood/iwd/ell/main.c:632
iwd: #9 0x4049ed in main() at ome/jprestwood/iwd/src/main.c:614
iwd: #10 0x7b5459629d90 in /lib/x86_64-linux-gnu/libc.so.6
iwd: #11 0x7b5459629e40 in /lib/x86_64-linux-gnu/libc.so.6
iwd: +++++++++++++++++++++++++++

To fix this we need to add checks for the cqm_poll_fallback flag in
netdev_rssi_polling_update().
---
src/netdev.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/netdev.c b/src/netdev.c
index d298977a1..8379a5983 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -769,11 +769,12 @@ static void netdev_rssi_poll(struct l_timeout *timeout, void *user_data)
/* To be called whenever operational or rssi_levels_num are updated */
static void netdev_rssi_polling_update(struct netdev *netdev)
{
- if (wiphy_has_ext_feature(netdev->wiphy,
+ if (!netdev->cqm_poll_fallback && wiphy_has_ext_feature(netdev->wiphy,
NL80211_EXT_FEATURE_CQM_RSSI_LIST))
return;

- if (netdev->operational && netdev->rssi_levels_num > 0) {
+ if (netdev->operational && (netdev->rssi_levels_num > 0 ||
+ netdev->cqm_poll_fallback)) {
if (netdev->rssi_poll_timeout)
return;

--
cgit 1.2.3-korg
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
install dbus services outside of systemd, allow activation with Exec= instead of
service-only until we have dbussy broker
--
--- a/Makefile.am 2019-10-30 06:50:34.000000000 -0400
+++ b/Makefile.am 2019-10-30 09:10:08.542128891 -0400
@@ -139,15 +139,15 @@
@@ -169,14 +169,14 @@
if DBUS_POLICY
dbus_datadir = @DBUS_DATADIR@/dbus-1/system.d
dist_dbus_data_DATA =
+
+dbus_busdir = @DBUS_BUSDIR@
+dbus_bus_DATA =
endif
Expand All @@ -15,11 +17,10 @@

-dbus_busdir = @DBUS_BUSDIR@
-dbus_bus_DATA =
-
systemd_networkdir = @SYSTEMD_NETWORKDIR@
systemd_network_DATA =

@@ -244,13 +244,13 @@
@@ -282,13 +282,13 @@

if DBUS_POLICY
dist_dbus_data_DATA += src/iwd-dbus.conf
Expand All @@ -34,7 +35,7 @@

systemd_network_DATA += src/80-iwd.link
endif
@@ -320,13 +320,13 @@
@@ -370,13 +370,13 @@

if DBUS_POLICY
dist_dbus_data_DATA += wired/ead-dbus.conf
Expand All @@ -49,17 +50,46 @@
endif

if MANUAL_PAGES
diff --git configure.ac configure.ac
index ec0619e..13d6de4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -188,7 +188,7 @@ AM_CONDITIONAL(SYSTEMD_SERVICE, test "${enable_systemd_service}" != "no")
AC_ARG_WITH([dbus-busdir], AC_HELP_STRING([--with-dbus-busdir=DIR],
@@ -238,7 +238,7 @@
AC_ARG_WITH([dbus-busdir], AS_HELP_STRING([--with-dbus-busdir=DIR],
[path to D-Bus bus services directory]),
[path_dbus_busdir=${withval}])
-if (test "${enable_systemd_service}" != "no" && test -z "${path_dbus_busdir}"); then
+if (test -z "${path_dbus_busdir}"); then
AC_MSG_CHECKING([D-Bus bus services directory])
path_dbus_busdir="`$PKG_CONFIG --variable=system_bus_services_dir dbus-1`"
if (test -z "${path_dbus_busdir}"); then

--- a/src/net.connman.iwd.service
+++ /dev/null
@@ -1,5 +0,0 @@
-[D-BUS Service]
-Name=net.connman.iwd
-Exec=/bin/false
-User=root
-SystemdService=iwd.service
--- /dev/null
+++ b/src/net.connman.iwd.service.in
@@ -0,0 +1,5 @@
+[D-BUS Service]
+Name=net.connman.iwd
+Exec=@libexecdir@/iwd
+User=root
+SystemdService=iwd.service
--- a/wired/net.connman.ead.service
+++ /dev/null
@@ -1,5 +0,0 @@
-[D-BUS Service]
-Name=net.connman.ead
-Exec=/bin/false
-User=root
-SystemdService=ead.service
--- /dev/null
+++ b/wired/net.connman.ead.service.in
@@ -0,0 +1,5 @@
+[D-BUS Service]
+Name=net.connman.ead
+Exec=@libexecdir@/ead
+User=root
+SystemdService=ead.service
90 changes: 0 additions & 90 deletions main/iwd/patches/support-traditional-dbus-activation.patch

This file was deleted.

3 changes: 1 addition & 2 deletions main/iwd/template.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pkgname = "iwd"
pkgver = "2.22"
pkgrel = 1
pkgrel = 2
build_style = "gnu_configure"
configure_args = [
# junk cflags that redefine FORTIFY
Expand All @@ -23,7 +23,6 @@
url = "https://iwd.wiki.kernel.org"
source = f"$(KERNEL_SITE)/network/wireless/iwd-{pkgver}.tar.xz"
sha256 = "2c41c5da9924b90f8383b293b0c0b3d0bfb34fdc8822d8d0d37ec100707f263e"
patch_style = "patch"
tool_flags = {
"CFLAGS": ["-Wno-unknown-warning-option", "-Wno-duplicate-decl-specifier"]
}
Expand Down

0 comments on commit 112c40f

Please sign in to comment.