can: dev: prevent potential information leak in can_fill_info()
Subsystems (2)
PATCH 1/1 can: dev: prevent potential information leak in can_fill_info()
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 <[email protected]>
--- drivers/net/can/dev/netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/dev/netlink.c +1 -1
@@ -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)
Signature · 1 line
2.29.2
Marc Kleine-Budde
maintainerHey Dan,
Quoted 6 lines · Dan Carpenter
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 <[email protected]>
Thanks for the patch. As this is a fix, I've backported it to net/master, which is before the split of the dev.c into separate files. Applied to linux-can/testing.
regards,
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |