From: Dan Carpenter <dan.carpenter@oracle.com>
To: colin@cozybit.com
Cc: linux-wireless@vger.kernel.org
Subject: re: libertas: if_spi, driver for libertas GSPI devices
Date: Tue, 17 Apr 2012 12:07:17 +0300 [thread overview]
Message-ID: <20120417090717.GA2339@elgon.mountain> (raw)
Hi Colin,
I was going through some old stuff and I had a question about a
potential overfow in if_spi_c2h_cmd().
714 } else if (len > IF_SPI_CMD_BUF_SIZE) {
^^^^^^^^^^^^^^^^^^^^^^^^^
We cap "len" at 2400 bytes here.
715 netdev_err(priv->dev,
716 "%s: error: response packet too large: %d bytes, but maximum is %d\n",
717 __func__, len, IF_SPI_CMD_BUF_SIZE);
718 err = -EINVAL;
719 goto out;
720 }
721
722 /* Read the data from the WLAN module into our command buffer */
723 err = spu_read(card, IF_SPI_CMD_RDWRPORT_REG,
724 card->cmd_buffer, ALIGN(len, 4));
725 if (err)
726 goto out;
727
728 spin_lock_irqsave(&priv->driver_lock, flags);
729 i = (priv->resp_idx == 0) ? 1 : 0;
730 BUG_ON(priv->resp_len[i]);
731 priv->resp_len[i] = len;
732 memcpy(priv->resp_buf[i], card->cmd_buffer, len);
^^^^^^^^^^^^^^^^
But ->resp_buf[i] can only hold LBS_UPLD_SIZE (2312) bytes, so we could
write past the end of the array.
733 lbs_notify_command_response(priv, i);
regards,
dan carpenter
reply other threads:[~2012-04-17 9:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20120417090717.GA2339@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=colin@cozybit.com \
--cc=linux-wireless@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox