diff options
author | Sergei Krainov <sergei.krainov.lkd@gmail.com> | 2021-04-09 15:46:11 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-04-09 17:16:10 +0300 |
commit | 3f8f36da0c5d6c40d90fc144d41d04950b9ec03f (patch) | |
tree | e7b9fd96f329a4c3d3a6596a2f69a1aeeb0266c3 /drivers | |
parent | b3dffce0e0aa7114fd6da1ce3e602044ed6254cc (diff) | |
download | linux-3f8f36da0c5d6c40d90fc144d41d04950b9ec03f.tar.xz |
staging: rtl8712: fix wrong function output
Return NULL from r8712_find_network() if no matched wlan_network
was found. Code with a bug:
while (plist != phead) {
pnetwork = container_of(plist, struct wlan_network, list);
plist = plist->next;
if (!memcmp(addr, pnetwork->network.MacAddress, ETH_ALEN))
break;
}
spin_unlock_irqrestore(&scanned_queue->lock, irqL);
return pnetwork;
In this code last processed pnetwork returned if list end was reached
and no pnetwork matched test condition.
Signed-off-by: Sergei Krainov <sergei.krainov.lkd@gmail.com>
Link: https://lore.kernel.org/r/20210409124611.GA3981@test-VirtualBox
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/rtl8712/rtl871x_mlme.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index 6328da8a498e..ba4a71e91ae0 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -146,6 +146,8 @@ static struct wlan_network *r8712_find_network(struct __queue *scanned_queue, if (!memcmp(addr, pnetwork->network.MacAddress, ETH_ALEN)) break; } + if (plist == phead) + pnetwork = NULL; spin_unlock_irqrestore(&scanned_queue->lock, irqL); return pnetwork; } |