From: Dan Carpenter <dan.carpenter@oracle.com>
To: Kalle Valo <kvalo@codeaurora.org>,
Hu Jiahui <kirin.say@gmail.com>,
Eric Dumazet <edumazet@google.com>
Cc: security@kernel.org, linux-wireless@vger.kernel.org,
Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH v3] airo: Fix read overflows sending packets
Date: Wed, 27 May 2020 21:48:30 +0300 [thread overview]
Message-ID: <20200527184830.GA1164846@mwanda> (raw)
In-Reply-To: <CANn89iKWzfAeK96iL_snfJ1jGnaWq0B5odZtC5o1_ccB8ECV9w@mail.gmail.com>
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: <stable@vger.kernel.org>
Reported-by: Hu Jiahui <kirin.say@gmail.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: remove an unnecessary if statement
increment the ->tx_dropped count on failure
fix found two more instances of the same bug.
fix typo in the "Cc: <stable@vger.kernel.org>" tag
v3: I had thought that skb_padto() updated skb->len so that it would
always be more than ETH_ZLEN meaning that we could delete the checks
for smaller values: "len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len;"
But I was wrong and those are still required.
drivers/net/wireless/cisco/airo.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c
index 8363f91df7ea7..827bb6d74815a 100644
--- a/drivers/net/wireless/cisco/airo.c
+++ b/drivers/net/wireless/cisco/airo.c
@@ -1925,6 +1925,10 @@ static netdev_tx_t mpi_start_xmit(struct sk_buff *skb,
airo_print_err(dev->name, "%s: skb == NULL!",__func__);
return NETDEV_TX_OK;
}
+ if (skb_padto(skb, ETH_ZLEN)) {
+ dev->stats.tx_dropped++;
+ return NETDEV_TX_OK;
+ }
npacks = skb_queue_len (&ai->txq);
if (npacks >= MAXTXQ - 1) {
@@ -2127,6 +2131,10 @@ static netdev_tx_t airo_start_xmit(struct sk_buff *skb,
airo_print_err(dev->name, "%s: skb == NULL!", __func__);
return NETDEV_TX_OK;
}
+ if (skb_padto(skb, ETH_ZLEN)) {
+ dev->stats.tx_dropped++;
+ return NETDEV_TX_OK;
+ }
/* Find a vacant FID */
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,
airo_print_err(dev->name, "%s: skb == NULL!", __func__);
return NETDEV_TX_OK;
}
+ if (skb_padto(skb, ETH_ZLEN)) {
+ dev->stats.tx_dropped++;
+ return NETDEV_TX_OK;
+ }
/* Find a vacant FID */
for( i = MAX_FIDS / 2; i < MAX_FIDS && (fids[i] & 0xffff0000); i++ );
--
2.26.2
next prev parent reply other threads:[~2020-05-27 18:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <EED43E20-9B88-42EC-80B0-0245F0FAF980@gmail.com>
2020-05-27 13:36 ` [PATCH resend] airo: Fix read overflow in mpi_send_packet() Dan Carpenter
2020-05-27 16:52 ` Eric Dumazet
2020-05-27 17:58 ` [PATCH v2] airo: Fix read overflows sending packets Dan Carpenter
2020-05-27 18:08 ` Eric Dumazet
2020-05-27 18:48 ` Dan Carpenter [this message]
2020-05-28 14:41 ` [PATCH v3] " Sasha Levin
2020-05-28 15:55 ` Eric Dumazet
2020-05-29 17:40 ` Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200527184830.GA1164846@mwanda \
--to=dan.carpenter@oracle.com \
--cc=edumazet@google.com \
--cc=kirin.say@gmail.com \
--cc=kuba@kernel.org \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=security@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.