]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: iwlwifi: tighten flags in debugfs command sending
authorJohannes Berg <johannes.berg@intel.com>
Tue, 12 May 2026 19:34:28 +0000 (22:34 +0300)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Tue, 26 May 2026 12:17:11 +0000 (15:17 +0300)
The only flags that could reasonably be used here are
CMD_WANT_SKB and CMD_ASYNC, CMD_SEND_IN_RFKILL doesn't
really make sense and CMD_BLOCK_TXQS just triggers a
warning, as does CMD_WANT_SKB | CMD_ASYNC.

Clear CMD_WANT_SKB since the response SKB isn't used
anyway, and refuse flags other than CMD_ASYNC to avoid
the warnings or other issues.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20260512222731.71b8cda9c4e8.I0cccfd67675989b48d003833f5813c8fbded45a6@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/debugfs.c

index ddee7c2deb36d5590bf64a43db00ffcaeec653d5..f06978d5b5ee3cb7650626ec77db34b892186ea4 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
 /*
- * Copyright (C) 2012-2014, 2018-2024 Intel Corporation
+ * Copyright (C) 2012-2014, 2018-2024, 2026 Intel Corporation
  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
  * Copyright (C) 2016-2017 Intel Deutschland GmbH
  */
@@ -275,16 +275,19 @@ static ssize_t iwl_dbgfs_send_hcmd_write(struct iwl_fw_runtime *fwrt, char *buf,
                goto out;
        }
 
+       /* ignore this flag, we cannot use the response */
+       hcmd.flags &= ~CMD_WANT_SKB;
+       /* reject flags other than async, they cannot be used this way */
+       if (hcmd.flags & ~CMD_ASYNC) {
+               ret = -EINVAL;
+               goto out;
+       }
+
        if (fwrt->ops && fwrt->ops->send_hcmd)
                ret = fwrt->ops->send_hcmd(fwrt->ops_ctx, &hcmd);
        else
                ret = -EPERM;
 
-       if (ret < 0)
-               goto out;
-
-       if (hcmd.flags & CMD_WANT_SKB)
-               iwl_free_resp(&hcmd);
 out:
        kfree(data);
        return ret ?: count;