Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4b60f88 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "wil6210: add verification for cid upper bound"

parents 14bc58fa 5f44d3ca
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -2155,7 +2155,8 @@ static int _wil_cfg80211_start_ap(struct wiphy *wiphy,
	if (pbss)
		wmi_nettype = WMI_NETTYPE_P2P;

	wil_dbg_misc(wil, "start_ap: mid=%d, is_go=%d\n", vif->mid, is_go);
	wil_dbg_misc(wil, "start_ap: mid=%d, is_go=%d ap_ps=%d\n", vif->mid,
		     is_go, wil->ap_ps);
	if (is_go && !pbss) {
		wil_err(wil, "P2P GO must be in PBSS\n");
		return -ENOTSUPP;
@@ -2247,6 +2248,14 @@ static int _wil_cfg80211_start_ap(struct wiphy *wiphy,
	if (rc)
		goto err_bcast;

	if (test_bit(WMI_FW_CAPABILITY_AP_POWER_MANAGEMENT,
		     wil->fw_capabilities)) {
		enum wmi_ps_profile_type ps_profile = wil->ap_ps ?
			wil->ps_profile : WMI_PS_PROFILE_TYPE_PS_DISABLED;

		wil_ps_update(wil, ps_profile);
	}

	goto out; /* success */

err_bcast:
@@ -3783,9 +3792,7 @@ static int wil_nl_60g_handle_cmd(struct wiphy *wiphy, struct wireless_dev *wdev,
				     "NL_60G_GEN_FW_RESET, resetting...\n");

			mutex_lock(&wil->mutex);
			down_write(&wil->mem_lock);
			rc = wil_reset(wil, true);
			up_write(&wil->mem_lock);
			mutex_unlock(&wil->mutex);

			break;
+1 −0
Original line number Diff line number Diff line
@@ -2460,6 +2460,7 @@ static const struct dbg_off dbg_wil_off[] = {
	WIL_FIELD(rx_buff_id_count, 0644,	doff_u32),
	WIL_FIELD(amsdu_en, 0644,	doff_u8),
	WIL_FIELD(force_edmg_channel, 0644,	doff_u8),
	WIL_FIELD(ap_ps, 0644, doff_u8),
	{},
};

+8 −4
Original line number Diff line number Diff line
@@ -1309,6 +1309,8 @@ void wil_refresh_fw_capabilities(struct wil6210_priv *wil)
	}

	update_supported_bands(wil);

	wil->ap_ps = test_bit(WIL_PLATFORM_CAPA_AP_PS, wil->platform_capa);
}

void wil_mbox_ring_le2cpus(struct wil6210_mbox_ring *r)
@@ -1751,6 +1753,8 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
	/* Disable device led before reset*/
	wmi_led_cfg(wil, false);

	down_write(&wil->mem_lock);

	/* prevent NAPI from being scheduled and prevent wmi commands */
	mutex_lock(&wil->wmi_mutex);
	if (test_bit(wil_status_suspending, wil->status))
@@ -1806,6 +1810,7 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)

		if  (wil->secured_boot) {
			wil_err(wil, "secured boot is not supported\n");
			up_write(&wil->mem_lock);
			return -ENOTSUPP;
		}

@@ -1836,6 +1841,8 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)

	clear_bit(wil_status_resetting, wil->status);

	up_write(&wil->mem_lock);

	if (load_fw) {
		wil_unmask_irq(wil);

@@ -1903,6 +1910,7 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
	return rc;

out:
	up_write(&wil->mem_lock);
	clear_bit(wil_status_resetting, wil->status);
	return rc;
}
@@ -1928,9 +1936,7 @@ int __wil_up(struct wil6210_priv *wil)

	WARN_ON(!mutex_is_locked(&wil->mutex));

	down_write(&wil->mem_lock);
	rc = wil_reset(wil, true);
	up_write(&wil->mem_lock);
	if (rc)
		return rc;

@@ -2023,9 +2029,7 @@ int __wil_down(struct wil6210_priv *wil)
	wil_abort_scan_all_vifs(wil, false);
	mutex_unlock(&wil->vif_mutex);

	down_write(&wil->mem_lock);
	rc = wil_reset(wil, false);
	up_write(&wil->mem_lock);

	return rc;
}
+2 −1
Original line number Diff line number Diff line
@@ -1047,6 +1047,7 @@ struct wil6210_priv {
	void *platform_handle;
	struct wil_platform_ops platform_ops;
	bool keep_radio_on_during_sleep;
	u8 ap_ps; /* AP mode power save enabled */

	struct pmc_ctx pmc;

@@ -1198,7 +1199,7 @@ static inline void wil_c(struct wil6210_priv *wil, u32 reg, u32 val)
 */
static inline bool wil_cid_valid(struct wil6210_priv *wil, int cid)
{
	return (cid >= 0 && cid < wil->max_assoc_sta);
	return (cid >= 0 && cid < wil->max_assoc_sta && cid < WIL6210_MAX_CID);
}

void wil_get_board_file(struct wil6210_priv *wil, char *buf, size_t len);
+13 −17
Original line number Diff line number Diff line
// SPDX-License-Identifier: ISC
/*
 * Copyright (c) 2015,2017 Qualcomm Atheros, Inc.
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include "wil6210.h"
@@ -57,7 +46,7 @@ static int wil_fw_get_crash_dump_bounds(struct wil6210_priv *wil,

int wil_fw_copy_crash_dump(struct wil6210_priv *wil, void *dest, u32 size)
{
	int i, rc;
	int i;
	const struct fw_map *map;
	void *data;
	u32 host_min, dump_size, offset, len;
@@ -73,9 +62,15 @@ int wil_fw_copy_crash_dump(struct wil6210_priv *wil, void *dest, u32 size)
		return -EINVAL;
	}

	rc = wil_mem_access_lock(wil);
	if (rc)
		return rc;
	down_write(&wil->mem_lock);

	if (test_bit(wil_status_suspending, wil->status) ||
	    test_bit(wil_status_suspended, wil->status)) {
		wil_err(wil,
			"suspend/resume in progress. cannot copy crash dump\n");
		up_write(&wil->mem_lock);
		return -EBUSY;
	}

	/* copy to crash dump area */
	for (i = 0; i < ARRAY_SIZE(fw_mapping); i++) {
@@ -95,7 +90,8 @@ int wil_fw_copy_crash_dump(struct wil6210_priv *wil, void *dest, u32 size)
		wil_memcpy_fromio_32((void * __force)(dest + offset),
				     (const void __iomem * __force)data, len);
	}
	wil_mem_access_unlock(wil);

	up_write(&wil->mem_lock);

	return 0;
}
Loading