From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Richard Palethorpe <rpalethorpe@suse.com>,
Kees Cook <keescook@chromium.org>,
linux-can@vger.kernel.org, netdev@vger.kernel.org,
security@kernel.org, wg@grandegger.com, mkl@pengutronix.de,
davem@davemloft.net, Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 5.6 068/129] slcan: Don't transmit uninitialized stack data in padding
Date: Wed, 15 Apr 2020 07:33:43 -0400 [thread overview]
Message-ID: <20200415113445.11881-68-sashal@kernel.org> (raw)
In-Reply-To: <20200415113445.11881-1-sashal@kernel.org>
From: Richard Palethorpe <rpalethorpe@suse.com>
[ Upstream commit b9258a2cece4ec1f020715fe3554bc2e360f6264 ]
struct can_frame contains some padding which is not explicitly zeroed in
slc_bump. This uninitialized data will then be transmitted if the stack
initialization hardening feature is not enabled (CONFIG_INIT_STACK_ALL).
This commit just zeroes the whole struct including the padding.
Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
Fixes: a1044e36e457 ("can: add slcan driver for serial/USB-serial CAN adapters")
Reviewed-by: Kees Cook <keescook@chromium.org>
Cc: linux-can@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: security@kernel.org
Cc: wg@grandegger.com
Cc: mkl@pengutronix.de
Cc: davem@davemloft.net
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/can/slcan.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index a3664281a33fc..4dfa459ef5c73 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -148,7 +148,7 @@ static void slc_bump(struct slcan *sl)
u32 tmpid;
char *cmd = sl->rbuff;
- cf.can_id = 0;
+ memset(&cf, 0, sizeof(cf));
switch (*cmd) {
case 'r':
@@ -187,8 +187,6 @@ static void slc_bump(struct slcan *sl)
else
return;
- *(u64 *) (&cf.data) = 0; /* clear payload */
-
/* RTR frames may have a dlc > 0 but they never have any data bytes */
if (!(cf.can_id & CAN_RTR_FLAG)) {
for (i = 0; i < cf.can_dlc; i++) {
--
2.20.1
next prev parent reply other threads:[~2020-04-15 12:55 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200415113445.11881-1-sashal@kernel.org>
2020-04-15 11:32 ` [PATCH AUTOSEL 5.6 007/129] net/mlx5e: Enforce setting of a single FEC mode Sasha Levin
2020-04-15 11:32 ` [PATCH AUTOSEL 5.6 011/129] bpf: Reliably preserve btf_trace_xxx types Sasha Levin
2020-04-15 11:33 ` [PATCH AUTOSEL 5.6 066/129] net: phy: at803x: fix clock sink configuration on ATH8030 and ATH8035 Sasha Levin
2020-04-15 11:33 ` [PATCH AUTOSEL 5.6 067/129] cxgb4: fix MPS index overwrite when setting MAC address Sasha Levin
2020-04-15 11:33 ` Sasha Levin [this message]
2020-04-15 17:09 ` [PATCH AUTOSEL 5.6 068/129] slcan: Don't transmit uninitialized stack data in padding Eric W. Biederman
2020-04-15 17:22 ` Greg KH
2020-04-16 0:04 ` Sasha Levin
2020-04-15 11:33 ` [PATCH AUTOSEL 5.6 069/129] net: qualcomm: rmnet: Allow configuration updates to existing devices Sasha Levin
2020-04-15 11:33 ` [PATCH AUTOSEL 5.6 071/129] net: stmmac: dwmac1000: fix out-of-bounds mac address reg setting Sasha Levin
2020-04-15 11:33 ` [PATCH AUTOSEL 5.6 072/129] net: dsa: mt7530: fix null pointer dereferencing in port5 setup Sasha Levin
2020-04-15 11:33 ` [PATCH AUTOSEL 5.6 073/129] tun: Don't put_page() for all negative return values from XDP program Sasha Levin
2020-04-15 11:33 ` [PATCH AUTOSEL 5.6 074/129] mlxsw: spectrum_flower: Do not stop at FLOW_ACTION_VLAN_MANGLE Sasha Levin
2020-04-15 11:33 ` [PATCH AUTOSEL 5.6 075/129] net: dsa: bcm_sf2: Do not register slave MDIO bus with OF Sasha Levin
2020-04-15 11:33 ` [PATCH AUTOSEL 5.6 076/129] macsec: fix NULL dereference in macsec_upd_offload() Sasha Levin
2020-04-15 11:34 ` [PATCH AUTOSEL 5.6 086/129] net: dsa: bcm_sf2: Ensure correct sub-node is parsed Sasha Levin
2020-04-15 11:34 ` [PATCH AUTOSEL 5.6 088/129] net: phy: micrel: kszphy_resume(): add delay after genphy_resume() before accessing PHY registers Sasha Levin
2020-04-15 11:34 ` [PATCH AUTOSEL 5.6 090/129] net: stmmac: xgmac: Fix VLAN register handling Sasha Levin
2020-04-15 11:34 ` [PATCH AUTOSEL 5.6 092/129] cxgb4: free MQPRIO resources in shutdown path Sasha Levin
2020-04-15 11:34 ` [PATCH AUTOSEL 5.6 110/129] SUNRPC: fix krb5p mount to provide large enough buffer in rq_rcvsize Sasha Levin
2020-04-15 11:34 ` [PATCH AUTOSEL 5.6 119/129] sunrpc: Fix gss_unwrap_resp_integ() again Sasha Levin
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=20200415113445.11881-68-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=davem@davemloft.net \
--cc=keescook@chromium.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=rpalethorpe@suse.com \
--cc=security@kernel.org \
--cc=stable@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).