Skip to content

Commit 11e7a91

Browse files
Dan CarpenterKalle Valo
authored andcommitted
airo: Fix read overflows sending packets
The problem is that we always copy a minimum of ETH_ZLEN (60) bytes from skb->data even when skb->len is less than ETH_ZLEN so it leads to a read overflow. The fix is to pad skb->data to at least ETH_ZLEN bytes. Cc: <[email protected]> Reported-by: Hu Jiahui <[email protected]> Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/20200527184830.GA1164846@mwanda
1 parent 113a57a commit 11e7a91

File tree

1 file changed

+12
-0
lines changed
  • drivers/net/wireless/cisco

1 file changed

+12
-0
lines changed

drivers/net/wireless/cisco/airo.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,6 +1925,10 @@ static netdev_tx_t mpi_start_xmit(struct sk_buff *skb,
19251925
airo_print_err(dev->name, "%s: skb == NULL!",__func__);
19261926
return NETDEV_TX_OK;
19271927
}
1928+
if (skb_padto(skb, ETH_ZLEN)) {
1929+
dev->stats.tx_dropped++;
1930+
return NETDEV_TX_OK;
1931+
}
19281932
npacks = skb_queue_len (&ai->txq);
19291933

19301934
if (npacks >= MAXTXQ - 1) {
@@ -2127,6 +2131,10 @@ static netdev_tx_t airo_start_xmit(struct sk_buff *skb,
21272131
airo_print_err(dev->name, "%s: skb == NULL!", __func__);
21282132
return NETDEV_TX_OK;
21292133
}
2134+
if (skb_padto(skb, ETH_ZLEN)) {
2135+
dev->stats.tx_dropped++;
2136+
return NETDEV_TX_OK;
2137+
}
21302138

21312139
/* Find a vacant FID */
21322140
for( i = 0; i < MAX_FIDS / 2 && (fids[i] & 0xffff0000); i++ );
@@ -2201,6 +2209,10 @@ static netdev_tx_t airo_start_xmit11(struct sk_buff *skb,
22012209
airo_print_err(dev->name, "%s: skb == NULL!", __func__);
22022210
return NETDEV_TX_OK;
22032211
}
2212+
if (skb_padto(skb, ETH_ZLEN)) {
2213+
dev->stats.tx_dropped++;
2214+
return NETDEV_TX_OK;
2215+
}
22042216

22052217
/* Find a vacant FID */
22062218
for( i = MAX_FIDS / 2; i < MAX_FIDS && (fids[i] & 0xffff0000); i++ );

0 commit comments

Comments
 (0)