From: Dan Carpenter <dan.carpenter@oracle.com>
To: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
linux-can@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH can tree] can: dev: prevent potential information leak in can_fill_info()
Date: Thu, 21 Jan 2021 09:08:05 +0300 [thread overview]
Message-ID: <YAkaRdRJncsJO8Ve@mwanda> (raw)
The "bec" struct isn't necessarily always initialized. For example,
the mcp251xfd_get_berr_counter() function doesn't initialize anything
if the interface is down.
Fixes: 52c793f24054 ("can: netlink support for bus-error reporting and counters")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/net/can/dev/netlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/can/dev/netlink.c b/drivers/net/can/dev/netlink.c
index 3ae884cdf677..7a1ff6fcbb8f 100644
--- a/drivers/net/can/dev/netlink.c
+++ b/drivers/net/can/dev/netlink.c
@@ -263,7 +263,7 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev)
{
struct can_priv *priv = netdev_priv(dev);
struct can_ctrlmode cm = {.flags = priv->ctrlmode};
- struct can_berr_counter bec;
+ struct can_berr_counter bec = {};
enum can_state state = priv->state;
if (priv->do_get_state)
--
2.29.2
next reply other threads:[~2021-01-21 6:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-21 6:08 Dan Carpenter [this message]
2021-01-21 7:37 ` [PATCH can tree] can: dev: prevent potential information leak in can_fill_info() Marc Kleine-Budde
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=YAkaRdRJncsJO8Ve@mwanda \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=mailhol.vincent@wanadoo.fr \
--cc=mkl@pengutronix.de \
--cc=wg@grandegger.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