Skip to content

Commit 9dc7efd

Browse files
SinkFinderKalle Valo
authored andcommitted
rndis_wlan: add return value validation
Function create_singlethread_workqueue() will return a NULL pointer if there is no enough memory, and its return value should be validated before using. However, in function rndis_wlan_bind(), its return value is not checked. This may cause NULL dereference bugs. This patch fixes it. Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
1 parent dc3f89c commit 9dc7efd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/net/wireless/rndis_wlan.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3428,6 +3428,10 @@ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf)
34283428

34293429
/* because rndis_command() sleeps we need to use workqueue */
34303430
priv->workqueue = create_singlethread_workqueue("rndis_wlan");
3431+
if (!priv->workqueue) {
3432+
wiphy_free(wiphy);
3433+
return -ENOMEM;
3434+
}
34313435
INIT_WORK(&priv->work, rndis_wlan_worker);
34323436
INIT_DELAYED_WORK(&priv->dev_poller_work, rndis_device_poller);
34333437
INIT_DELAYED_WORK(&priv->scan_work, rndis_get_scan_results);

0 commit comments

Comments
 (0)