Skip to contentSkip to conversation

staging: vt6656: rxtx.c [BUG] s_vGetFreeContext dead lock on null apTD.

PATCH New Malcolm Priestley 1 participant 1 message Sep 22, 2013 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: vt6656: rxtx.c [BUG] s_vGetFreeContext dead lock on null apTD.

There seems to be race condition that the device is ndo_start_xmit at a point where the device is closing and apTD is NULL resulting in dead lock.

Add a NULL check to apTD and return NULL to calling functions.

This is more likely on 64 bit systems.

---
 drivers/staging/vt6656/rxtx.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/staging/vt6656/rxtx.c +2 -0
index fb743a8..14f3e85 100644
@@ -148,6 +148,8 @@ static void *s_vGetFreeContext(struct vnt_private *pDevice)
     DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"GetFreeContext()\n");
 
     for (ii = 0; ii < pDevice->cbTD; ii++) {
+	if (!pDevice->apTD[ii])
+		return NULL;
         pContext = pDevice->apTD[ii];
         if (pContext->bBoolInUse == false) {
             pContext->bBoolInUse = true;
Signature · 1 line
1.8.3.2