Skip to content

Commit

Permalink
enic: reset fetch index
Browse files Browse the repository at this point in the history
Since we are allowing rx ring size modification, reset fetch index
everytime. Otherwise it could have a stale value that can lead to a null
pointer dereference.

Signed-off-by: Govindarajulu Varadarajan <gvaradar@cisco.com>
Signed-off-by: Parvi Kaustubhi <pkaustub@cisco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Parvi Kaustubhi authored and David S. Miller committed Nov 2, 2017
1 parent 59c1cec commit e6cdfcc
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions drivers/net/ethernet/cisco/enic/vnic_rq.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,20 +139,8 @@ void vnic_rq_init(struct vnic_rq *rq, unsigned int cq_index,
unsigned int error_interrupt_enable,
unsigned int error_interrupt_offset)
{
u32 fetch_index = 0;

/* Use current fetch_index as the ring starting point */
fetch_index = ioread32(&rq->ctrl->fetch_index);

if (fetch_index == 0xFFFFFFFF) { /* check for hardware gone */
/* Hardware surprise removal: reset fetch_index */
fetch_index = 0;
}

vnic_rq_init_start(rq, cq_index,
fetch_index, fetch_index,
error_interrupt_enable,
error_interrupt_offset);
vnic_rq_init_start(rq, cq_index, 0, 0, error_interrupt_enable,
error_interrupt_offset);
}

unsigned int vnic_rq_error_status(struct vnic_rq *rq)
Expand Down

0 comments on commit e6cdfcc

Please sign in to comment.