All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH can tree] can: dev: prevent potential information leak in can_fill_info()
@ 2021-01-21  6:08 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-01-21  6:08 UTC (permalink / raw)
  To: Wolfgang Grandegger
  Cc: Marc Kleine-Budde, Vincent Mailhol, linux-can, kernel-janitors

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH can tree] can: dev: prevent potential information leak in can_fill_info()
@ 2021-01-21  6:08 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-01-21  6:08 UTC (permalink / raw)
  To: Wolfgang Grandegger
  Cc: Marc Kleine-Budde, Vincent Mailhol, linux-can, kernel-janitors

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH can tree] can: dev: prevent potential information leak in can_fill_info()
  2021-01-21  6:08 ` Dan Carpenter
@ 2021-01-21  7:37   ` Marc Kleine-Budde
  -1 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2021-01-21  7:37 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Wolfgang Grandegger, Vincent Mailhol, linux-can, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 856 bytes --]

Hey Dan,

On Thu, Jan 21, 2021 at 09:08:05AM +0300, Dan Carpenter wrote:
> 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>

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

-- 
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 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH can tree] can: dev: prevent potential information leak in can_fill_info()
@ 2021-01-21  7:37   ` Marc Kleine-Budde
  0 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2021-01-21  7:37 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Wolfgang Grandegger, Vincent Mailhol, linux-can, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 856 bytes --]

Hey Dan,

On Thu, Jan 21, 2021 at 09:08:05AM +0300, Dan Carpenter wrote:
> 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>

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

-- 
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 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-21  7:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21  6:08 [PATCH can tree] can: dev: prevent potential information leak in can_fill_info() Dan Carpenter
2021-01-21  6:08 ` Dan Carpenter
2021-01-21  7:37 ` Marc Kleine-Budde
2021-01-21  7:37   ` Marc Kleine-Budde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.