Commit 03cd7136 authored by Roel Kluin's avatar Roel Kluin Committed by Greg Kroah-Hartman

Staging: vt6655: fix possible Read buffer overflow

If pDevice->sOpts.nRxDescs{0,1} or nTxDescs[{0,1}] is zero, the loop ends with
i == 0, and we write aRD{0,1}Ring[-1]. apTD{0,1}Rings[-1] respectively.
Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 256a816b
......@@ -1400,6 +1400,7 @@ static void device_init_rd0_ring(PSDevice pDevice) {
pDesc->next_desc = cpu_to_le32(curr + sizeof(SRxDesc));
}
if (i > 0)
pDevice->aRD0Ring[i-1].next_desc = cpu_to_le32(pDevice->rd0_pool_dma);
pDevice->pCurrRD[0] = &(pDevice->aRD0Ring[0]);
}
......@@ -1424,6 +1425,7 @@ static void device_init_rd1_ring(PSDevice pDevice) {
pDesc->next_desc = cpu_to_le32(curr + sizeof(SRxDesc));
}
if (i > 0)
pDevice->aRD1Ring[i-1].next_desc = cpu_to_le32(pDevice->rd1_pool_dma);
pDevice->pCurrRD[1] = &(pDevice->aRD1Ring[0]);
}
......@@ -1517,6 +1519,7 @@ static void device_init_td0_ring(PSDevice pDevice) {
pDesc->next_desc = cpu_to_le32(curr+sizeof(STxDesc));
}
if (i > 0)
pDevice->apTD0Rings[i-1].next_desc = cpu_to_le32(pDevice->td0_pool_dma);
pDevice->apTailTD[0] = pDevice->apCurrTD[0] =&(pDevice->apTD0Rings[0]);
......@@ -1542,6 +1545,7 @@ static void device_init_td1_ring(PSDevice pDevice) {
pDesc->next_desc = cpu_to_le32(curr+sizeof(STxDesc));
}
if (i > 0)
pDevice->apTD1Rings[i-1].next_desc = cpu_to_le32(pDevice->td1_pool_dma);
pDevice->apTailTD[1] = pDevice->apCurrTD[1] = &(pDevice->apTD1Rings[0]);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment