From: Colin Ian King <colin.king@canonical.com>
To: Markus Mayer <mmayer@broadcom.com>,
bcm-kernel-feedback-list@broadcom.com,
Krzysztof Kozlowski <krzk@kernel.org>,
Florian Fainelli <f.fainelli@gmail.com>,
linux-arm-kernel@lists.infradead.org
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: out of bounds access on array error_text[] because of -ETIMEDOUT return from __send_command()
Date: Tue, 18 Aug 2020 13:21:00 +0100 [thread overview]
Message-ID: <38d00022-730c-948a-917c-d86382df8cb9@canonical.com> (raw)
Hi,
static analysis with coverity has found a buffer overflow issue with the
brcmstb driver, I believe it may have been introduced with the following
commit:
commit a7c25759d8d84b64c437a78f05df7314b02934e5
Author: Markus Mayer <mmayer@broadcom.com>
Date: Tue Apr 2 16:01:00 2019 -0700
memory: brcmstb: dpfe: wait for DCPU to be ready
The static analysis is as follows for the source file
/drivers/memory/brcmstb_dpfe.c :
684 static ssize_t generic_show(unsigned int command, u32 response[],
685 struct brcmstb_dpfe_priv *priv, char *buf)
686 {
687 int ret;
688
1. Condition !priv, taking false branch.
689 if (!priv)
690 return sprintf(buf, "ERROR: driver private data not
set\n");
691
2. return_constant: Function call __send_command(priv, command,
response) may return -110.
3. assignment: Assigning: ret = __send_command(priv, command,
response). The value of ret is now -110.
692 ret = __send_command(priv, command, response);
4. Condition ret < 0, taking true branch.
693 if (ret < 0)
Out-of-bounds read (OVERRUN)
5. overrun-local: Overrunning array error_text of 6 8-byte elements
at element index 110 (byte offset 887) using index -ret (which evaluates
to 110).
694 return sprintf(buf, "ERROR: %s\n", error_text[-ret]);
695
696 return 0;
697 }
Function __send_command() can return -ETIMEDOUT and this causes an
out-of-bounds access on error_text[].
Colin
next reply other threads:[~2020-08-18 12:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-18 12:21 Colin Ian King [this message]
2020-08-19 18:34 ` Florian Fainelli
2020-08-20 17:23 ` Markus Mayer
2020-08-21 1:04 ` Markus Mayer
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=38d00022-730c-948a-917c-d86382df8cb9@canonical.com \
--to=colin.king@canonical.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=f.fainelli@gmail.com \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mmayer@broadcom.com \
/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
all inboxes | Powered by JetHome®