Procházet zdrojové kódy

qcacmn: Check null pointer before use

In API hif_batch_send(), the variable ce_tx_hdl is dereferenced in
if_batch_send() without null check. Check for null before use to
avoid dereference a NULL pointer.

Change-Id: I05c38e180a448522d13d68369b77b45314eac227
CRs-Fixed: 2968584
Wenxiu Han před 4 roky
rodič
revize
e17a5d9251
1 změnil soubory, kde provedl 3 přidání a 0 odebrání
  1. 3 0
      hif/src/hif_main.c

+ 3 - 0
hif/src/hif_main.c

@@ -1947,6 +1947,9 @@ qdf_nbuf_t hif_batch_send(struct hif_opaque_softc *osc, qdf_nbuf_t msdu,
 {
 	void *ce_tx_hdl = hif_get_ce_handle(osc, CE_HTT_TX_CE);
 
+	if (!ce_tx_hdl)
+		return NULL;
+
 	return ce_batch_send((struct CE_handle *)ce_tx_hdl, msdu, transfer_id,
 			len, sendhead);
 }