Pārlūkot izejas kodu

qcacmn: Check return value for channel conversion

It may return NULL, which pass to another function and dereference it.
Check return value, don't pass to another function if return value is
NULL.

Change-Id: Ib2e87231bb724c5631c12e9bee98c22d4dcc9bf2
CRs-Fixed: 2233639
Wu Gao 7 gadi atpakaļ
vecāks
revīzija
ee9b1761a7
1 mainītis faili ar 5 papildinājumiem un 0 dzēšanām
  1. 5 0
      os_if/linux/p2p/src/wlan_cfg80211_p2p.c

+ 5 - 0
os_if/linux/p2p/src/wlan_cfg80211_p2p.c

@@ -286,6 +286,11 @@ static void wlan_p2p_event_callback(void *user_data,
 
 
 	chan = ieee80211_get_channel(wdev->wiphy,
 	chan = ieee80211_get_channel(wdev->wiphy,
 				     wlan_chan_to_freq(p2p_event->chan));
 				     wlan_chan_to_freq(p2p_event->chan));
+	if (!chan) {
+		cfg80211_err("channel conversion failed");
+		goto fail;
+	}
+
 	if (p2p_event->roc_event == ROC_EVENT_READY_ON_CHAN) {
 	if (p2p_event->roc_event == ROC_EVENT_READY_ON_CHAN) {
 		cfg80211_ready_on_channel(wdev,
 		cfg80211_ready_on_channel(wdev,
 			p2p_event->cookie, chan,
 			p2p_event->cookie, chan,