Skip to content

Commit

Permalink
be2net: Avoid accessing eq object in be_msix_register routine, when i…
Browse files Browse the repository at this point in the history
… < 0.

When the first request_irq fails in be_msix_register, i value
would be zero. The current code decrements the i value and
accesses the eq object without validating the decremented
"i" value. This can cause an "invalid memory address access"
violation.

This patch fixes the problem by accessing the eq object after
validating the "i" value.

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Venkat Duvvuru authored and David S. Miller committed Dec 18, 2015
1 parent 6be842f commit 6e3cd5f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/ethernet/emulex/benet/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3299,8 +3299,10 @@ static int be_msix_register(struct be_adapter *adapter)

return 0;
err_msix:
for (i--, eqo = &adapter->eq_obj[i]; i >= 0; i--, eqo--)
for (i--; i >= 0; i--) {
eqo = &adapter->eq_obj[i];
free_irq(be_msix_vec_get(adapter, eqo), eqo);
}
dev_warn(&adapter->pdev->dev, "MSIX Request IRQ failed - err %d\n",
status);
be_msix_disable(adapter);
Expand Down

0 comments on commit 6e3cd5f

Please sign in to comment.