mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 16:44:58 +02:00
rtase: Fix improper release of ring list entries in rtase_sw_reset
Since rtase_init_ring, which is called within rtase_sw_reset, adds ring
entries already present in the ring list back into the list, it causes
the ring list to form a cycle. This results in list_for_each_entry_safe
failing to find an endpoint during traversal, leading to an error.
Therefore, it is necessary to remove the previously added ring_list nodes
before calling rtase_init_ring.
Fixes: 0796004899 ("rtase: Implement net_device_ops")
Signed-off-by: Justin Lai <justinlai0215@realtek.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250306070510.18129-1-justinlai0215@realtek.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
3121a1ef96
commit
415f135ace
|
|
@ -1501,7 +1501,10 @@ static void rtase_wait_for_quiescence(const struct net_device *dev)
|
|||
static void rtase_sw_reset(struct net_device *dev)
|
||||
{
|
||||
struct rtase_private *tp = netdev_priv(dev);
|
||||
struct rtase_ring *ring, *tmp;
|
||||
struct rtase_int_vector *ivec;
|
||||
int ret;
|
||||
u32 i;
|
||||
|
||||
netif_stop_queue(dev);
|
||||
netif_carrier_off(dev);
|
||||
|
|
@ -1512,6 +1515,13 @@ static void rtase_sw_reset(struct net_device *dev)
|
|||
rtase_tx_clear(tp);
|
||||
rtase_rx_clear(tp);
|
||||
|
||||
for (i = 0; i < tp->int_nums; i++) {
|
||||
ivec = &tp->int_vector[i];
|
||||
list_for_each_entry_safe(ring, tmp, &ivec->ring_list,
|
||||
ring_entry)
|
||||
list_del(&ring->ring_entry);
|
||||
}
|
||||
|
||||
ret = rtase_init_ring(dev);
|
||||
if (ret) {
|
||||
netdev_err(dev, "unable to init ring\n");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user