diff mbox series

[net] can: dev: prevent potential information leak in can_fill_info()

Message ID 20210127094028.2778793-2-mkl@pengutronix.de (mailing list archive)
State Accepted
Commit b552766c872f5b0d90323b24e4c9e8fa67486dd5
Delegated to: Netdev Maintainers
Headers show
Series [net] can: dev: prevent potential information leak in can_fill_info() | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers warning 1 maintainers not CCed: wg@grandegger.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Marc Kleine-Budde Jan. 27, 2021, 9:40 a.m. UTC
From: Dan Carpenter <dan.carpenter@oracle.com>

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")
Link: https://lore.kernel.org/r/YAkaRdRJncsJO8Ve@mwanda
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: b491e6a7391e3ecdebdd7a097550195cc878924a

Comments

patchwork-bot+netdevbpf@kernel.org Jan. 28, 2021, 2 a.m. UTC | #1
Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Wed, 27 Jan 2021 10:40:28 +0100 you wrote:
> From: Dan Carpenter <dan.carpenter@oracle.com>
> 
> 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")
> Link: https://lore.kernel.org/r/YAkaRdRJncsJO8Ve@mwanda
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> 
> [...]

Here is the summary with links:
  - [net] can: dev: prevent potential information leak in can_fill_info()
    https://git.kernel.org/netdev/net/c/b552766c872f

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 8b1ae023cb21..c73e2a65c904 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -1163,7 +1163,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)