Prechádzať zdrojové kódy

qcacmn: Protect read of urb_cnt with spin lock

Protect read of device pipe urb count with spin lock.

Change-Id: Ia5d3860e4030155bbc78f47ddda79ae0573465ec
CRs-Fixed: 2451406
Ajit Pal Singh 5 rokov pred
rodič
commit
6bc40004ea
1 zmenil súbory, kde vykonal 7 pridanie a 1 odobranie
  1. 7 1
      hif/src/usb/hif_usb.c

+ 7 - 1
hif/src/usb/hif_usb.c

@@ -298,8 +298,14 @@ uint16_t hif_get_free_queue_number(struct hif_opaque_softc *scn,
 				   uint8_t pipe_id)
 {
 	struct HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn);
+	struct HIF_USB_PIPE *pipe = &device->pipes[pipe_id];
+	u16 urb_cnt;
+
+	qdf_spin_lock_irqsave(&pipe->device->cs_lock);
+	urb_cnt =  pipe->urb_cnt;
+	qdf_spin_unlock_irqrestore(&pipe->device->cs_lock);
 
-	return device->pipes[pipe_id].urb_cnt;
+	return urb_cnt;
 }
 
 /**