SIOCSIFFLAGS: I/O error when trying to bring up wifi interface

Hello,

Today I upgraded OpenWRT on my BananaPi R64 to version 23.05.
After the upgrade, the WiFi does not work anymore.

Output of ip link show:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1504 qdisc mq state UP qlen 1000
    link/ether 9e:20:01:14:0f:3f brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether b2:f6:0b:99:99:98 brd ff:ff:ff:ff:ff:ff
4: wan@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master switch0 state LOWERLAYERDOWN qlen 1000
    link/ether 9e:20:01:14:0f:3f brd ff:ff:ff:ff:ff:ff
5: lan1@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master switch0 state LOWERLAYERDOWN qlen 1000
    link/ether 9e:20:01:14:0f:3f brd ff:ff:ff:ff:ff:ff
6: lan2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master switch0 state UP qlen 1000
    link/ether 9e:20:01:14:0f:3f brd ff:ff:ff:ff:ff:ff
7: lan3@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master switch0 state LOWERLAYERDOWN qlen 1000
    link/ether 9e:20:01:14:0f:3f brd ff:ff:ff:ff:ff:ff
8: lan4@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master switch0 state LOWERLAYERDOWN qlen 1000
    link/ether 9e:20:01:14:0f:3f brd ff:ff:ff:ff:ff:ff
11: switch0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether 9e:20:01:14:0f:3f brd ff:ff:ff:ff:ff:ff
12: switch0.40@switch0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether 9e:20:01:14:0f:3f brd ff:ff:ff:ff:ff:ff
13: vpn: <POINTOPOINT,NOARP> mtu 1420 qdisc noop state DOWN qlen 1000
    link/[65534] 
14: wl2-sta0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 9e:20:01:14:0f:41 brd ff:ff:ff:ff:ff:ff
15: wlan2-mesh: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether d6:b4:0a:1b:d8:77 brd ff:ff:ff:ff:ff:ff

I can see that the WiFi interface wl2-sta0 is down.
If I try to bring it up using ip link set dev wl2-sta0 up,
I just get this error message: ip: SIOCSIFFLAGS: I/O error.

This is the relevant wireless config:

config wifi-device 'radio1'
        option type 'mac80211'
        option path '1a145000.pcie/pci0001:00/0001:00:01.0/0001:01:00.0'
        option channel '13'
        option band '2g'
        option htmode 'HT20'
        option disabled '0'

config wifi-iface 'default_radio1'
        option device 'radio1'
        option network 'uplink_network'
        option mode 'sta'
        option ssid '<snip>'
        option encryption 'psk2+tkip+ccmp'
        option key '<snip>'

Did anyone else have this kind of problem after upgrading to 23.05?
How can I try to solve this problem?

Thank you!

I'm not sure if this is your problem, but I see that you don't have a country code set. Channel 13 is not valid in certain places (such as North America), so in the absence of a country code, I think that OpenWrt defaults to the lowest common denominator of channels (and power levels) allowed in all jurisdictions.

Try including your country code and/or changing to a different channel (since you're in STA mode, you may want to set the channel to auto, as well).

Hmm no that did not help.
I ran the ip command through strace and it failed on an ioctl call:

execve("/sbin/ip", ["ip", "link", "set", "dev", "wl2-sta0", "up"], 0x7fea429da8 /* 13 vars */) = 0
set_tid_address(0x7fa0e6c258)           = 3832
brk(NULL)                               = 0x23215000
brk(0x23217000)                         = 0x23217000
mmap(0x23215000, 4096, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x23215000
openat(AT_FDCWD, "/etc/ld-musl-aarch64.path", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/libgcc_s.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=131088, ...}) = 0
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 960) = 960
mmap(NULL, 200704, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x7fa0d99000
mmap(0x7fa0dc8000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x1f000) = 0x7fa0dc8000
close(3)                                = 0
mprotect(0x7fa0dc8000, 4096, PROT_READ) = 0
mprotect(0x47f000, 4096, PROT_READ)     = 0
prctl(PR_GET_NAME, "ip")                = 0
socket(AF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
ioctl(3, SIOCGIFFLAGS, {ifr_name="wl2-sta0", ifr_flags=IFF_BROADCAST|IFF_MULTICAST}) = 0
ioctl(3, SIOCSIFFLAGS, {ifr_name="wl2-sta0", ifr_flags=IFF_UP|IFF_BROADCAST|IFF_MULTICAST}) = -1 EIO (I/O error)
write(2, "ip: SIOCSIFFLAGS: I/O error\n", 28ip: SIOCSIFFLAGS: I/O error
) = 28
exit_group(2)                           = ?
+++ exited with 2 +++

Because it said I/O error I thought maybe there is something wrong with the filesystem. But weirdly enough, the ioctl call before that succeeds. It only crashes when trying to set IFF_UP.
Also, If it fails on an ioctl call, is it even config related?