From a8e89215591e5f6be3e90056b8a981f6d099ec48 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 15 Apr 2018 10:11:57 +0200 Subject: [PATCH] mt7603: add more checks to avoid dereferencing invalid pointers in wcid lookup Signed-off-by: Felix Fietkau --- mt7603_mac.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mt7603_mac.c b/mt7603_mac.c index aebfe682..4621d734 100644 --- a/mt7603_mac.c +++ b/mt7603_mac.c @@ -363,7 +363,13 @@ mt7603_rx_get_wcid(struct mt7603_dev *dev, u8 idx, bool unicast) if (unicast || !wcid) return wcid; + if (!wcid->sta) + return NULL; + sta = container_of(wcid, struct mt7603_sta, wcid); + if (!sta->vif) + return NULL; + return &sta->vif->wcid; }