From 57b81122926adba64e70605d64ff5eaebfd6f0da Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Sat, 14 Oct 2017 20:29:15 -0500 Subject: [PATCH] rtl8723ds: Fix NULL dereference error The driver is crashing with the following: Unable to handle kernel NULL pointer dereference at virtual address 00000000 ... PC is at cfg80211_scan_done+0x28/0x64 [cfg80211] LR is at cfg80211_rtw_scan+0x724/0x800 [8723ds] The faulty statement is cfg80211_scan_done(request, 0); Sending a simple integer as the second argument of cfg80211_scan_done() is only valid for kernel 4.7 and earlier. Signed-off-by: Larry Finger --- os_dep/linux/ioctl_cfg80211.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index c6706c2..82762d2 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -2281,6 +2281,11 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy #ifdef CONFIG_P2P struct wifidirect_info *pwdinfo; #endif /* CONFIG_P2P */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)) + struct cfg80211_scan_info info = { + .aborted = 0 + }; +#endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) wdev = request->wdev; @@ -2481,7 +2486,11 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy check_need_indicate_scan_done: if (_TRUE == need_indicate_scan_done) { _rtw_cfg80211_surveydone_event_callback(padapter, request); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)) + cfg80211_scan_done(request, &info); +#else cfg80211_scan_done(request, 0); +#endif } cancel_ps_deny: