forked from Minki/linux
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>
This commit is contained in:
parent
b3dffce0e0
commit
3f8f36da0c
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user