Commit 2e0ce1de authored by Anjaneyulu's avatar Anjaneyulu Committed by Johannes Berg

wifi: iwlwifi: Validate slots_num before allocating memory

Verify slots_num is valid in iwl_txq_alloc()
Signed-off-by: default avatarAnjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123447.90be48017c1b.I880e451e137c5cd688d5f38b573b0dbf352762b3@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent aedb2b38
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/* /*
* Copyright (C) 2020-2022 Intel Corporation * Copyright (C) 2020-2023 Intel Corporation
*/ */
#include <net/tso.h> #include <net/tso.h>
#include <linux/tcp.h> #include <linux/tcp.h>
...@@ -1027,6 +1027,9 @@ int iwl_txq_alloc(struct iwl_trans *trans, struct iwl_txq *txq, int slots_num, ...@@ -1027,6 +1027,9 @@ int iwl_txq_alloc(struct iwl_trans *trans, struct iwl_txq *txq, int slots_num,
size_t tb0_buf_sz; size_t tb0_buf_sz;
int i; int i;
if (WARN_ONCE(slots_num <= 0, "Invalid slots num:%d\n", slots_num))
return -EINVAL;
if (WARN_ON(txq->entries || txq->tfds)) if (WARN_ON(txq->entries || txq->tfds))
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment