Skip to contentSkip to conversation

igb: Fix oops on changing number of rings

PATCH New Toshiaki Makita 3 participants 6 messages Apr 13, 2015 – May 2, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 igb: Fix oops on changing number of rings

When changing the number of rings by ethtool -L, q_vectors are reused, which causes oops because of uninitialized pointers.

- When an rx is reused as a tx, q_vector->rx.ring is not set to NULL, which misleads igb_poll() to determine that it has an rx ring although it actually points to the tx ring.
- When a tx is reused as an rx, q_vector->rx.ring->skb (q_vector->ring[0].skb) has a value that was used as tx_stats before.

Fix these problems by zeroing it out on reuseing it.

Fixes 02ef6e1d0b00 ("igb: Fix queue allocation method to accommodate changing during runtime")
---
 drivers/net/ethernet/intel/igb/igb_main.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/igb/igb_main.c +2 -0
index f366b3b..010ddcb 100644
@@ -1207,6 +1207,8 @@ static int igb_alloc_q_vector(struct igb_adapter *adapter,
 	q_vector = adapter->q_vector[v_idx];
 	if (!q_vector)
 		q_vector = kzalloc(size, GFP_KERNEL);
+	else
+		memset(q_vector, 0, size);
 	if (!q_vector)
 		return -ENOMEM;
 
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 2/2 igb: Fix NULL assignment to incorrect variable in igb_reset_q_vector

adapter->tx_ring is set to NULL where rx_ring should be.

Fixes 5536d2102a2d ("igb: Combine q_vector and ring allocation into a single function")
---
 drivers/net/ethernet/intel/igb/igb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/igb/igb_main.c +1 -1
index 010ddcb..b664512 100644
@@ -1036,7 +1036,7 @@ static void igb_reset_q_vector(struct igb_adapter *adapter, int v_idx)
 		adapter->tx_ring[q_vector->tx.ring->queue_index] = NULL;
 
 	if (q_vector->rx.ring)
-		adapter->tx_ring[q_vector->rx.ring->queue_index] = NULL;
+		adapter->rx_ring[q_vector->rx.ring->queue_index] = NULL;
 
 	netif_napi_del(&q_vector->napi);
 
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH 2/2 igb: Fix NULL assignment to incorrect variable in igb_reset_q_vector

Quoted 8 lines · Toshiaki Makita

adapter->tx_ring is set to NULL where rx_ring should be.

Fixes 5536d2102a2d ("igb: Combine q_vector and ring allocation into a

single function")

---
 drivers/net/ethernet/intel/igb/igb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks Toshiaki, I have applied your patch to my queue.

Signature · 9 lines
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-queue.git
dev-queue
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20150414/0d351407/attachment.asc>
#3 lore raw

PATCH 2/2 igb: Fix NULL assignment to incorrect variable in igb_reset_q_vector

Quoted 11 lines

From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Jeff Kirsher
Sent: Tuesday, April 14, 2015 6:03 AM
To: Toshiaki Makita
Cc: intel-wired-lan at lists.osuosl.org
Subject: Re: [Intel-wired-lan] [PATCH net 2/2] igb: Fix NULL assignment to incorrect variable in igb_reset_q_vector

Quoted 2 lines · Toshiaki Makita

adapter->tx_ring is set to NULL where rx_ring should be.

Quoted 8 lines
Quoted 6 lines
Fixes 5536d2102a2d ("igb: Combine q_vector and ring allocation into a

single function")

---
 drivers/net/ethernet/intel/igb/igb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks Toshiaki, I have applied your patch to my queue.

#4 lore raw

PATCH 1/2 igb: Fix oops on changing number of rings

In reply to Toshiaki Makita
Quoted 11 lines · Toshiaki Makita

When changing the number of rings by ethtool -L, q_vectors are reused, which causes oops because of uninitialized pointers.

- When an rx is reused as a tx, q_vector->rx.ring is not set to NULL, which
misleads igb_poll() to determine that it has an rx ring although it actually points to the tx ring.
- When a tx is reused as an rx, q_vector->rx.ring->skb (q_vector->ring[0].skb) has a value that was used as tx_stats
before.

Quoted 8 lines

Fix these problems by zeroing it out on reuseing it.

Fixes 02ef6e1d0b00 ("igb: Fix queue allocation method to accommodate

changing during runtime")

---
 drivers/net/ethernet/intel/igb/igb_main.c | 2 ++
 1 file changed, 2 insertions(+)

Thanks Toshiaki, I have applied your patch to my queue.

Signature · 9 lines
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-queue.git
dev-queue
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20150414/fcb21064/attachment.asc>
#5 lore raw

PATCH 1/2 igb: Fix oops on changing number of rings

Quoted 29 lines

From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Jeff Kirsher
Sent: Tuesday, April 14, 2015 6:02 AM
To: Toshiaki Makita
Cc: intel-wired-lan at lists.osuosl.org
Subject: Re: [Intel-wired-lan] [PATCH net 1/2] igb: Fix oops on changing number of rings

Quoted 11 lines · Toshiaki Makita

When changing the number of rings by ethtool -L, q_vectors are reused, which causes oops because of uninitialized pointers.

- When an rx is reused as a tx, q_vector->rx.ring is not set to NULL, which
misleads igb_poll() to determine that it has an rx ring although it actually points to the tx ring.
- When a tx is reused as an rx, q_vector->rx.ring->skb (q_vector->ring[0].skb) has a value that was used as tx_stats
before.

Quoted 8 lines

Fix these problems by zeroing it out on reuseing it.

Fixes 02ef6e1d0b00 ("igb: Fix queue allocation method to accommodate

changing during runtime")

---
 drivers/net/ethernet/intel/igb/igb_main.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 2 lines

Thanks Toshiaki, I have applied your patch to my queue. --