Skip to content

WiFi broke on kernel 5.8.3 #54

Description

@sleepyeldrazi

Device: Surface Book 2
Distro: Manjaro
Previous Kernel: 5.8.1
Kernel After Update: 5.8.3
Date of Update: 24. Aug 2020
Kernel downloaded through yay from the repo: https://pkg.surfacelinux.com/arch/

I should mention that i couldn't connect to neither the 2.4GHz nor 5Ghz network from my router. I was however able to connect to a mobile hotspot (OnePlus 6T). After downgrading to 5.8.1 the issue was instantly resolved. I will attempt to build from commit 233bcf2 and see if works there.

Activity

  1. qzed commented on Aug 24, 2020

    @qzed
    Member

    I can't reproduce this on my SB2 with my home WiFi. There haven't been any changes between 5.8.1 to 5.8.3 to the WiFi drivers from our side, so if any change caused this, it should be an upstream one. If you want to track this down, you should merge upstream v5.8.3 on top of v5.8-surface-devel (which is based off of v5.8) and bisect from there.

  2. qzed commented on Aug 24, 2020

    @qzed
    Member

    As far as I can tell, this seems to be the only commit to mwifiex that could cause something like this: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.8.y&id=bc2599182f8ec577ca81a6de40349e94fb9734df

  3. sleepyeldrazi commented on Aug 24, 2020

    @sleepyeldrazi
    Author

    Small update, the kernel from the commit i mentioned (233bcf2) doesn't have this problem. I am currently trying to setup anbox, after which i might investigate why the WiFi wasn't working as intended on 5.8.3 . My kernel knowledge is pretty bad but I will try to do my best to find the issue.

  4. claucambra commented on Aug 24, 2020

    @claucambra

    Wanted to chime in and say I have been having this issue since last night on my Surface Pro 6 too. WiFi works out of the box after installation of a distro, but fails to authenticate with my home WiFi password-protected network after installing the Linux-Surface kernel. Simply keeps asking to introduce the password. Occurs on Ubuntu 20.04 (and derivatives Pop_OS and KDE Neon) as well as Manjaro.

    Connects to my phone hotspot fine but not to my home WiFi network. WiFi works perfectly on Windows, but no surprises there.

  5. sleepyeldrazi commented on Aug 24, 2020

    @sleepyeldrazi
    Author

    Wanted to chime in and say I have been having this issue since last night on my Surface Pro 6 too. WiFi works out of the box after installation of a distro, but fails to authenticate with my home WiFi password-protected network after installing the Linux-Surface kernel. Simply keeps asking to introduce the password. Occurs on Ubuntu 20.04 (and derivatives Pop_OS and KDE Neon) as well as Manjaro.

    Connects to my phone hotspot fine but not to my home WiFi network. WiFi works perfectly on Windows, but no surprises there.

    Exactly the same behavior as me then, I forgot to mention the repeated asking for the password.

    EDIT: Probably unrelated since this has been happening for a while now, but since at least 5.7 my wifi is extremely slow (max 1-2mbps) until i turn off bluetooth. I doubt it's connected but in case it helps I wanted to mention it.

  6. qzed commented on Aug 24, 2020

    @qzed
    Member

    @sleepyeldrazi I kind of expected that that commit works, as it's based on v5.8 and not v5.8.3. Can you try building a v5.8.3 kernel (e.g. from the v5.8-surface branch) and add some debug output to the commit I linked above? Specifically replace it with something like (adding in the pr_err calls):

    diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
    index f21660149f584..962d8bfe6f101 100644
    --- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
    +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
    @@ -580,6 +580,11 @@ static int mwifiex_ret_802_11_key_material_v1(struct mwifiex_private *priv,
     {
     	struct host_cmd_ds_802_11_key_material *key =
     						&resp->params.key_material;
    +	int len;
    +
    +	len = le16_to_cpu(key->key_param_set.key_len);
    +	if (len > sizeof(key->key_param_set.key)) {
    +		pr_err("mwifiex-DEBUG: len > sizeof(key->key_param_set.key in %s\n", __func__);
    +		pr_err("mwifiex-DEBUG: len: %u\n", len);
    +		return -EINVAL;
    +	}
     
     	if (le16_to_cpu(key->action) == HostCmd_ACT_GEN_SET) {
     		if ((le16_to_cpu(key->key_param_set.key_info) & KEY_MCAST)) {
    @@ -593,9 +598,8 @@ static int mwifiex_ret_802_11_key_material_v1(struct mwifiex_private *priv,
     
     	memset(priv->aes_key.key_param_set.key, 0,
     	       sizeof(key->key_param_set.key));
    -	priv->aes_key.key_param_set.key_len = key->key_param_set.key_len;
    -	memcpy(priv->aes_key.key_param_set.key, key->key_param_set.key,
    -	       le16_to_cpu(priv->aes_key.key_param_set.key_len));
    +	priv->aes_key.key_param_set.key_len = cpu_to_le16(len);
    +	memcpy(priv->aes_key.key_param_set.key, key->key_param_set.key, len);
     
     	return 0;
     }
    @@ -610,9 +614,14 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv,
     					      struct host_cmd_ds_command *resp)
     {
     	struct host_cmd_ds_802_11_key_material_v2 *key_v2;
    -	__le16 len;
    +	int len;
     
     	key_v2 = &resp->params.key_material_v2;
    +
    +	len = le16_to_cpu(key_v2->key_param_set.key_params.aes.key_len);
    +	if (len > WLAN_KEY_LEN_CCMP)
    +		pr_err("mwifiex-DEBUG: len > sizeof(key->key_param_set.key in %s\n", __func__);
    +		pr_err("mwifiex-DEBUG: len: %u\n", len);
    +		return -EINVAL;
    +	}
    +
     	if (le16_to_cpu(key_v2->action) == HostCmd_ACT_GEN_SET) {
     		if ((le16_to_cpu(key_v2->key_param_set.key_info) & KEY_MCAST)) {
     			mwifiex_dbg(priv->adapter, INFO, "info: key: GTK is set\n");
    @@ -628,10 +637,9 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv,
     	memset(priv->aes_key_v2.key_param_set.key_params.aes.key, 0,
     	       WLAN_KEY_LEN_CCMP);
     	priv->aes_key_v2.key_param_set.key_params.aes.key_len =
    -				key_v2->key_param_set.key_params.aes.key_len;
    -	len = priv->aes_key_v2.key_param_set.key_params.aes.key_len;
    +				cpu_to_le16(len);
     	memcpy(priv->aes_key_v2.key_param_set.key_params.aes.key,
    -	       key_v2->key_param_set.key_params.aes.key, le16_to_cpu(len));
    +	       key_v2->key_param_set.key_params.aes.key, len);
     
     	return 0;
     }

    And then check the dmesg log.

    Edit: Added a pr_err statement for printing the actual length.

  7. qzed commented on Aug 24, 2020

    @qzed
    Member

    The speed/bluetooth thing is a known issue and tracked somewhere on the linux-surface repo.

  8. claucambra commented on Aug 24, 2020

    @claucambra

    I can't reproduce this on my SB2 with my home WiFi. There haven't been any changes between 5.8.1 to 5.8.3 to the WiFi drivers from our side, so if any change caused this, it should be an upstream one. If you want to track this down, you should merge upstream v5.8.3 on top of v5.8-surface-devel (which is based off of v5.8) and bisect from there.

    Right, so here's what I did (Surface Pro 6):

    1. Resize Windows 10 partition in Windows' Disk Management
    2. Install Pop_OS 20.04 (Wi-Fi working)
    3. Follow the linux-surface installation guide here (Wi-Fi still working)
    4. Reboot
    5. Touchscreen etc. working under Linux-Surface kernel, but can't connect to Wi-Fi network I was previously connecting to as per detailed in my prior comment.

    Please let me know if there's some way I can be of use; I'd like to also provide the dmesg log you asked @sleepyeldrazi for if it'd be of any use to you, but honestly I'm not super Linux-savvy and am lost as to how to help.

  9. qzed commented on Aug 24, 2020

    @qzed
    Member

    @elChupaCambra I assume that this can only be reproduced on certain network configurations. If my guess with the commit above is correct, it should depend on the key length (nb: key is not password here).

  10. sleepyeldrazi commented on Aug 24, 2020

    @sleepyeldrazi
    Author

    dmesg.txt
    dmesg_grep_mwifiex.txt
    One is the complete dmesg, the other is with grep mwifiex. Sorry for the wait.

  11. qzed commented on Aug 25, 2020

    @qzed
    Member

    Alright, looks like my assumption was correct. The log reports a key size of 256 bit (32 bytes), but the storage is only 128 bit (16 bytes), and with the newly introduced check, it fails there. Given that it more or less worked before adding that check, I'd say we try upgrade that to 32 bytes. Here's a patch that does that (don't be confused by the .txt ending, GitHub doesn't allow uploading patches in comments). Can you try applying that to the v5.3-surface branch and test again?

  12. sleepyeldrazi commented on Aug 25, 2020

    @sleepyeldrazi
    Author

    EDIT: It looks like i really did apply the patch wrong. It works now. I'll remove the pr_err checks and build again just in case and I'll post my git diff at the end.

  13. sleepyeldrazi commented on Aug 25, 2020

    @sleepyeldrazi
    Author

    diff.txt
    Wifi works as expected now. Thanks for the support.

  14. claucambra commented on Aug 25, 2020

    @claucambra

    Hi @qzed and @sleepyeldrazi, thanks for the hard work. How can a newbie like myself apply this patch?

    I have found the folder:
    "/usr/lib/modules/5.8.3-arch1-1-surface/kernel/drivers/net/wireless/marvell/mwifiex/" which seems similar to the one you posted in your .txt files, except I can't find the "fw.h" or "sta_cmdresp.c" files on my Manjaro install. Is this because you guys are talking about files changed before building the linux-surface kernel? If so, could you point me to how I can apply this patch (or a resource that could show me how to do so?)

    Thank you for your time!

  15. 20 remaining items

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A: mwifiexArea: Issue in marvel/mwifiex driverC: bug (upstream)Category: Upstream bug (tracked upstream)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions