stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, Antoine Tenart <atenart@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.10 45/95] net: atlantic: macsec: clear encryption keys from the stack
Date: Mon, 14 Nov 2022 13:45:39 +0100	[thread overview]
Message-ID: <20221114124444.402791650@linuxfoundation.org> (raw)
In-Reply-To: <20221114124442.530286937@linuxfoundation.org>

From: Antoine Tenart <atenart@kernel.org>

[ Upstream commit 879785def0f5e71d54399de0f8a5cb399db14171 ]

Commit aaab73f8fba4 ("macsec: clear encryption keys from the stack after
setting up offload") made sure to clean encryption keys from the stack
after setting up offloading, but the atlantic driver made a copy and did
not clear it. Fix this.

[4 Fixes tags below, all part of the same series, no need to split this]

Fixes: 9ff40a751a6f ("net: atlantic: MACSec ingress offload implementation")
Fixes: b8f8a0b7b5cb ("net: atlantic: MACSec ingress offload HW bindings")
Fixes: 27736563ce32 ("net: atlantic: MACSec egress offload implementation")
Fixes: 9d106c6dd81b ("net: atlantic: MACSec egress offload HW bindings")
Signed-off-by: Antoine Tenart <atenart@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 .../net/ethernet/aquantia/atlantic/aq_macsec.c |  2 ++
 .../aquantia/atlantic/macsec/macsec_api.c      | 18 +++++++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c
index 7c6e0811f2e6..ee823a18294c 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c
@@ -585,6 +585,7 @@ static int aq_update_txsa(struct aq_nic_s *nic, const unsigned int sc_idx,
 
 	ret = aq_mss_set_egress_sakey_record(hw, &key_rec, sa_idx);
 
+	memzero_explicit(&key_rec, sizeof(key_rec));
 	return ret;
 }
 
@@ -932,6 +933,7 @@ static int aq_update_rxsa(struct aq_nic_s *nic, const unsigned int sc_idx,
 
 	ret = aq_mss_set_ingress_sakey_record(hw, &sa_key_record, sa_idx);
 
+	memzero_explicit(&sa_key_record, sizeof(sa_key_record));
 	return ret;
 }
 
diff --git a/drivers/net/ethernet/aquantia/atlantic/macsec/macsec_api.c b/drivers/net/ethernet/aquantia/atlantic/macsec/macsec_api.c
index 36c7cf05630a..431924959520 100644
--- a/drivers/net/ethernet/aquantia/atlantic/macsec/macsec_api.c
+++ b/drivers/net/ethernet/aquantia/atlantic/macsec/macsec_api.c
@@ -757,6 +757,7 @@ set_ingress_sakey_record(struct aq_hw_s *hw,
 			 u16 table_index)
 {
 	u16 packed_record[18];
+	int ret;
 
 	if (table_index >= NUMROWS_INGRESSSAKEYRECORD)
 		return -EINVAL;
@@ -789,9 +790,12 @@ set_ingress_sakey_record(struct aq_hw_s *hw,
 
 	packed_record[16] = rec->key_len & 0x3;
 
-	return set_raw_ingress_record(hw, packed_record, 18, 2,
-				      ROWOFFSET_INGRESSSAKEYRECORD +
-					      table_index);
+	ret = set_raw_ingress_record(hw, packed_record, 18, 2,
+				     ROWOFFSET_INGRESSSAKEYRECORD +
+				     table_index);
+
+	memzero_explicit(packed_record, sizeof(packed_record));
+	return ret;
 }
 
 int aq_mss_set_ingress_sakey_record(struct aq_hw_s *hw,
@@ -1739,14 +1743,14 @@ static int set_egress_sakey_record(struct aq_hw_s *hw,
 	ret = set_raw_egress_record(hw, packed_record, 8, 2,
 				    ROWOFFSET_EGRESSSAKEYRECORD + table_index);
 	if (unlikely(ret))
-		return ret;
+		goto clear_key;
 	ret = set_raw_egress_record(hw, packed_record + 8, 8, 2,
 				    ROWOFFSET_EGRESSSAKEYRECORD + table_index -
 					    32);
-	if (unlikely(ret))
-		return ret;
 
-	return 0;
+clear_key:
+	memzero_explicit(packed_record, sizeof(packed_record));
+	return ret;
 }
 
 int aq_mss_set_egress_sakey_record(struct aq_hw_s *hw,
-- 
2.35.1




  parent reply	other threads:[~2022-11-14 12:51 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14 12:44 [PATCH 5.10 00/95] 5.10.155-rc1 review Greg Kroah-Hartman
2022-11-14 12:44 ` [PATCH 5.10 01/95] fuse: fix readdir cache race Greg Kroah-Hartman
2022-11-14 12:44 ` [PATCH 5.10 02/95] hwspinlock: qcom: correct MMIO max register for newer SoCs Greg Kroah-Hartman
2022-11-14 12:44 ` [PATCH 5.10 03/95] phy: stm32: fix an error code in probe Greg Kroah-Hartman
2022-11-14 12:44 ` [PATCH 5.10 04/95] wifi: cfg80211: silence a sparse RCU warning Greg Kroah-Hartman
2022-11-14 12:44 ` [PATCH 5.10 05/95] wifi: cfg80211: fix memory leak in query_regdb_file() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 06/95] bpf, sockmap: Fix the sk->sk_forward_alloc warning of sk_stream_kill_queues Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 07/95] bpftool: Fix NULL pointer dereference when pin {PROG, MAP, LINK} without FILE Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 08/95] HID: hyperv: fix possible memory leak in mousevsc_probe() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 09/95] bpf: Support for pointers beyond pkt_end Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 10/95] bpf: Add helper macro bpf_for_each_reg_in_vstate Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 11/95] bpf: Fix wrong reg type conversion in release_reference() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 12/95] net: gso: fix panic on frag_list with mixed head alloc types Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 13/95] macsec: delete new rxsc when offload fails Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 14/95] macsec: fix secy->n_rx_sc accounting Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 15/95] macsec: fix detection of RXSCs when toggling offloading Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 16/95] macsec: clear encryption keys from the stack after setting up offload Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 17/95] net: tun: Fix memory leaks of napi_get_frags Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 18/95] bnxt_en: Fix possible crash in bnxt_hwrm_set_coal() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 19/95] bnxt_en: fix potentially incorrect return value for ndo_rx_flow_steer Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 20/95] net: fman: Unregister ethernet device on removal Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 21/95] capabilities: fix undefined behavior in bit shift for CAP_TO_MASK Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 22/95] KVM: s390x: fix SCK locking Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 23/95] KVM: s390: pv: dont allow userspace to set the clock under PV Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 24/95] net: lapbether: fix issue of dev reference count leakage in lapbeth_device_event() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 25/95] hamradio: fix issue of dev reference count leakage in bpq_device_event() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 26/95] drm/vc4: Fix missing platform_unregister_drivers() call in vc4_drm_register() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 27/95] tcp: prohibit TCP_REPAIR_OPTIONS if data was already sent Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 28/95] ipv6: addrlabel: fix infoleak when sending struct ifaddrlblmsg to network Greg Kroah-Hartman
2022-11-14 12:48   ` syzbot
2022-11-14 12:45 ` [PATCH 5.10 29/95] can: af_can: fix NULL pointer dereference in can_rx_register() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 30/95] net: stmmac: dwmac-meson8b: fix meson8b_devm_clk_prepare_enable() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 31/95] net: broadcom: Fix BCMGENET Kconfig Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 32/95] tipc: fix the msg->req tlv len check in tipc_nl_compat_name_table_dump_header Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 33/95] dmaengine: pxa_dma: use platform_get_irq_optional Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 34/95] dmaengine: mv_xor_v2: Fix a resource leak in mv_xor_v2_remove() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 35/95] drivers: net: xgene: disable napi when register irq failed in xgene_enet_open() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 36/95] perf stat: Fix printing os->prefix in CSV metrics output Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 37/95] net: marvell: prestera: fix memory leak in prestera_rxtx_switch_init() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 38/95] net: nixge: disable napi when enable interrupts failed in nixge_open() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 39/95] net/mlx5: Allow async trigger completion execution on single CPU systems Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 40/95] net/mlx5e: E-Switch, Fix comparing termination table instance Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 41/95] net: cpsw: disable napi in cpsw_ndo_open() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 42/95] net: cxgb3_main: disable napi when bind qsets failed in cxgb_up() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 43/95] cxgb4vf: shut down the adapter when t4vf_update_port_info() failed in cxgb4vf_open() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 44/95] net: phy: mscc: macsec: clear encryption keys when freeing a flow Greg Kroah-Hartman
2022-11-14 12:45 ` Greg Kroah-Hartman [this message]
2022-11-14 12:45 ` [PATCH 5.10 46/95] ethernet: s2io: disable napi when start nic failed in s2io_card_up() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 47/95] net: mv643xx_eth: disable napi when init rxq or txq failed in mv643xx_eth_open() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 48/95] ethernet: tundra: free irq when alloc ring failed in tsi108_open() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 49/95] net: macvlan: fix memory leaks of macvlan_common_newlink Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 50/95] riscv: process: fix kernel info leakage Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 51/95] riscv: vdso: fix build with llvm Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 52/95] riscv: Enable CMA support Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 53/95] riscv: Separate memory init from paging init Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 54/95] riscv: fix reserved memory setup Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 55/95] arm64: efi: Fix handling of misaligned runtime regions and drop warning Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 56/95] MIPS: jump_label: Fix compat branch range check Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 57/95] mmc: cqhci: Provide helper for resetting both SDHCI and CQHCI Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 58/95] mmc: sdhci-of-arasan: Fix SDHCI_RESET_ALL for CQHCI Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 59/95] mmc: sdhci_am654: " Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 60/95] mmc: sdhci-tegra: " Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 61/95] ALSA: hda/hdmi - enable runtime pm for more AMD display audio Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 62/95] ALSA: hda/ca0132: add quirk for EVGA Z390 DARK Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 63/95] ALSA: hda: fix potential memleak in add_widget_node Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 64/95] ALSA: hda/realtek: Add Positivo C6300 model quirk Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 65/95] ALSA: usb-audio: Add quirk entry for M-Audio Micro Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 66/95] ALSA: usb-audio: Add DSD support for Accuphase DAC-60 Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 67/95] vmlinux.lds.h: Fix placement of .data..decrypted section Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 68/95] ata: libata-scsi: fix SYNCHRONIZE CACHE (16) command failure Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 69/95] nilfs2: fix deadlock in nilfs_count_free_blocks() Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 70/95] nilfs2: fix use-after-free bug of ns_writer on remount Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 71/95] drm/i915/dmabuf: fix sg_table handling in map_dma_buf Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 72/95] platform/x86: hp_wmi: Fix rfkill causing soft blocked wifi Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 73/95] btrfs: selftests: fix wrong error check in btrfs_free_dummy_root() Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 74/95] mms: sdhci-esdhc-imx: Fix SDHCI_RESET_ALL for CQHCI Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 75/95] udf: Fix a slab-out-of-bounds write bug in udf_find_entry() Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 76/95] mm/memremap.c: map FS_DAX device memory as decrypted Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 77/95] can: j1939: j1939_send_one(): fix missing CAN header initialization Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 78/95] cert host tools: Stop complaining about deprecated OpenSSL functions Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 79/95] dmaengine: at_hdmac: Fix at_lli struct definition Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 80/95] dmaengine: at_hdmac: Dont start transactions at tx_submit level Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 81/95] dmaengine: at_hdmac: Start transfer for cyclic channels in issue_pending Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 82/95] dmaengine: at_hdmac: Fix premature completion of desc " Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 83/95] dmaengine: at_hdmac: Do not call the complete callback on device_terminate_all Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 84/95] dmaengine: at_hdmac: Protect atchan->status with the channel lock Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 85/95] dmaengine: at_hdmac: Fix concurrency problems by removing atc_complete_all() Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 86/95] dmaengine: at_hdmac: Fix concurrency over descriptor Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 87/95] dmaengine: at_hdmac: Free the memset buf without holding the chan lock Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 88/95] dmaengine: at_hdmac: Fix concurrency over the active list Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 89/95] dmaengine: at_hdmac: Fix descriptor handling when issuing it to hardware Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 90/95] dmaengine: at_hdmac: Fix completion of unissued descriptor in case of errors Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 91/95] dmaengine: at_hdmac: Dont allow CPU to reorder channel enable Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 92/95] dmaengine: at_hdmac: Fix impossible condition Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 93/95] dmaengine: at_hdmac: Check return code of dma_async_device_register Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 94/95] net: tun: call napi_schedule_prep() to ensure we own a napi Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 95/95] mmc: sdhci-esdhc-imx: Convert the driver to DT-only Greg Kroah-Hartman
2022-11-14 18:35 ` [PATCH 5.10 00/95] 5.10.155-rc1 review Pavel Machek
2022-11-14 20:20 ` Shuah Khan
2022-11-14 21:06 ` Slade Watkins
2022-11-14 21:44 ` Florian Fainelli
2022-11-15  0:12 ` Guenter Roeck
2022-11-15 10:50 ` Sudip Mukherjee
2022-11-15 10:58 ` Naresh Kamboju
2022-11-15 11:49 ` Rudi Heitbaum
2022-11-16  1:44 ` zhouzhixiu

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=20221114124444.402791650@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=atenart@kernel.org \
    --cc=pabeni@redhat.com \
    --cc=patches@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /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).