Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Mar 2021 01:33:37 GMT
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 51dfae383bf6 - main - [ath] validate ts_antenna before updating tx statistics
Message-ID:  <202103130133.12D1Xb8Q086099@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by adrian:

URL: https://cgit.FreeBSD.org/src/commit/?id=51dfae383bf6298af9e6d816a78b92b6f34d68be

commit 51dfae383bf6298af9e6d816a78b92b6f34d68be
Author:     Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2021-03-13 01:29:09 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2021-03-13 01:33:07 +0000

    [ath] validate ts_antenna before updating tx statistics
    
    Right now ts_antenna is either 0 or 1 in each supported HAL so
    this is purely a sanity check.
    
    Later on if I ever get magical free time I may add some extensions
    for the NICs that can have slightly more complicated antenna switches
    for transmit and I'd like this to not bust memory.
---
 sys/dev/ath/if_ath.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index 34a9311c834a..0ef10e529dd5 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -4175,6 +4175,11 @@ ath_tx_update_stats(struct ath_softc *sc, struct ath_tx_status *ts,
 
 	if (ts->ts_status == 0) {
 		u_int8_t txant = ts->ts_antenna;
+		/*
+		 * Handle weird/corrupted tx antenna field
+		 */
+		if (txant >= ATH_IOCTL_STATS_NUM_TX_ANTENNA)
+			txant = 0;
 		sc->sc_stats.ast_ant_tx[txant]++;
 		sc->sc_ant_tx[txant]++;
 		if (ts->ts_finaltsi != 0)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103130133.12D1Xb8Q086099>