nvethernet: fix common irq free path

issue: freeing common irq in ether_free_irqs without check

fix: Use mask for common interrupt as well so it can be used to
check before freeing irq

Bug 200512422

Change-Id: I694ba983658fae3da6948ceda18d24c11f08d458
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2081600
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Rakesh Goyal
2019-03-15 11:44:18 +05:30
committed by Revanth Kumar Uppala
parent 2893067ed3
commit 0975ee4989
2 changed files with 8 additions and 1 deletions

View File

@@ -245,7 +245,10 @@ static void ether_free_irqs(struct ether_priv_data *pdata)
unsigned int i; unsigned int i;
unsigned int chan; unsigned int chan;
if (pdata->common_irq_alloc_mask & 1U) {
devm_free_irq(pdata->dev, pdata->common_irq, pdata); devm_free_irq(pdata->dev, pdata->common_irq, pdata);
pdata->common_irq_alloc_mask = 0U;
}
for (i = 0; i < pdata->osi_dma->num_dma_chans; i++) { for (i = 0; i < pdata->osi_dma->num_dma_chans; i++) {
chan = pdata->osi_dma->dma_chans[i]; chan = pdata->osi_dma->dma_chans[i];
@@ -253,10 +256,12 @@ static void ether_free_irqs(struct ether_priv_data *pdata)
if (pdata->rx_irq_alloc_mask & (1U << i)) { if (pdata->rx_irq_alloc_mask & (1U << i)) {
devm_free_irq(pdata->dev, pdata->rx_irqs[i], devm_free_irq(pdata->dev, pdata->rx_irqs[i],
pdata->rx_napi[chan]); pdata->rx_napi[chan]);
pdata->rx_irq_alloc_mask &= (~(1U << i));
} }
if (pdata->tx_irq_alloc_mask & (1U << i)) { if (pdata->tx_irq_alloc_mask & (1U << i)) {
devm_free_irq(pdata->dev, pdata->tx_irqs[i], devm_free_irq(pdata->dev, pdata->tx_irqs[i],
pdata->tx_napi[chan]); pdata->tx_napi[chan]);
pdata->tx_irq_alloc_mask &= (~(1U << i));
} }
} }
} }
@@ -292,6 +297,7 @@ static int ether_request_irqs(struct ether_priv_data *pdata)
pdata->common_irq); pdata->common_irq);
return ret; return ret;
} }
pdata->common_irq_alloc_mask = 1;
for (i = 0; i < osi_dma->num_dma_chans; i++) { for (i = 0; i < osi_dma->num_dma_chans; i++) {
chan = osi_dma->dma_chans[i]; chan = osi_dma->dma_chans[i];

View File

@@ -127,6 +127,7 @@ struct ether_priv_data {
unsigned int rx_irq_alloc_mask; unsigned int rx_irq_alloc_mask;
unsigned int tx_irq_alloc_mask; unsigned int tx_irq_alloc_mask;
unsigned int common_irq_alloc_mask;
int common_irq; int common_irq;
int tx_irqs[ETHER_MAX_IRQS]; int tx_irqs[ETHER_MAX_IRQS];