mailweb.openeuler.org
Manage this list

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

Kernel

Threads by month
  • ----- 2025 -----
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
kernel@openeuler.org

  • 14 participants
  • 18883 discussions
[PATCH openEuler-22.03-LTS-SP1 6/6] Add MODULE_FIRMWARE() for FIRMWARE_TG357766.
by Baogen Shang 14 Mar '24

14 Mar '24
From: Tobias Heider <me(a)tobhe.de> stable inclusion from stable-v5.10.188 commit c377451012cec94f01b6c698409fec865e55dd3f category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8L4MY Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id… -------------------------------- [ Upstream commit 046f753da6143ee16452966915087ec8b0de3c70 ] Fixes a bug where on the M1 mac mini initramfs-tools fails to include the necessary firmware into the initrd. Fixes: c4dab50697ff ("tg3: Download 57766 EEE service patch firmware") Signed-off-by: Tobias Heider <me(a)tobhe.de> Reviewed-by: Michael Chan <michael.chan(a)broadcom.com> Link: https://lore.kernel.org/r/ZJt7LKzjdz8+dClx@tobhe.de Signed-off-by: Jakub Kicinski <kuba(a)kernel.org> Signed-off-by: Sasha Levin <sashal(a)kernel.org> Signed-off-by: Dapeng Yu <dapeng.yu(a)windriver.com> --- drivers/net/ethernet/broadcom/tg3.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 9eb716acac04..39bef1809a97 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -224,6 +224,7 @@ MODULE_AUTHOR("David S. Miller (davem(a)redhat.com) and Jeff Garzik (jgarzik@pobox MODULE_DESCRIPTION("Broadcom Tigon3 ethernet driver"); MODULE_LICENSE("GPL"); MODULE_FIRMWARE(FIRMWARE_TG3); +MODULE_FIRMWARE(FIRMWARE_TG357766); MODULE_FIRMWARE(FIRMWARE_TG3TSO); MODULE_FIRMWARE(FIRMWARE_TG3TSO5); -- 2.43.0
1 0
0 0
[PATCH openEuler-22.03-LTS-SP1 5/6] bnxt_en: Implement .set_port / .unset_port UDP tunnel callbacks
by Baogen Shang 14 Mar '24

14 Mar '24
From: Somnath Kotur <somnath.kotur(a)broadcom.com> stable inclusion from stable-v5.10.184 commit 3f6dfff5fe416bda6469cf235eaa9c54fee2a0bc category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8L4MY Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id… -------------------------------- [ Upstream commit 1eb4ef12591348c440ac9d6efcf7521e73cf2b10 ] As per the new udp tunnel framework, drivers which need to know the details of a port entry (i.e. port type) when it gets deleted should use the .set_port / .unset_port callbacks. Implementing the current .udp_tunnel_sync callback would mean that the deleted tunnel port entry would be all zeros. This used to work on older firmware because it would not check the input when deleting a tunnel port. With newer firmware, the delete will now fail and subsequent tunnel port allocation will fail as a result. Fixes: 442a35a5a7aa ("bnxt: convert to new udp_tunnel_nic infra") Reviewed-by: Kalesh Anakkur Purayil <kalesh-anakkur.purayil(a)broadcom.com> Signed-off-by: Somnath Kotur <somnath.kotur(a)broadcom.com> Signed-off-by: Michael Chan <michael.chan(a)broadcom.com> Signed-off-by: Paolo Abeni <pabeni(a)redhat.com> Signed-off-by: Sasha Levin <sashal(a)kernel.org> Signed-off-by: Dapeng Yu <dapeng.yu(a)windriver.com> --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 25 ++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 4db84ed9d698..3dc826353b02 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -12099,26 +12099,37 @@ static void bnxt_cfg_ntp_filters(struct bnxt *bp) #endif /* CONFIG_RFS_ACCEL */ -static int bnxt_udp_tunnel_sync(struct net_device *netdev, unsigned int table) +static int bnxt_udp_tunnel_set_port(struct net_device *netdev, unsigned int table, + unsigned int entry, struct udp_tunnel_info *ti) { struct bnxt *bp = netdev_priv(netdev); - struct udp_tunnel_info ti; unsigned int cmd; - udp_tunnel_nic_get_port(netdev, table, 0, &ti); - if (ti.type == UDP_TUNNEL_TYPE_VXLAN) + if (ti->type == UDP_TUNNEL_TYPE_VXLAN) cmd = TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN; else cmd = TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_GENEVE; - if (ti.port) - return bnxt_hwrm_tunnel_dst_port_alloc(bp, ti.port, cmd); + return bnxt_hwrm_tunnel_dst_port_alloc(bp, ti->port, cmd); +} + +static int bnxt_udp_tunnel_unset_port(struct net_device *netdev, unsigned int table, + unsigned int entry, struct udp_tunnel_info *ti) +{ + struct bnxt *bp = netdev_priv(netdev); + unsigned int cmd; + + if (ti->type == UDP_TUNNEL_TYPE_VXLAN) + cmd = TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN; + else + cmd = TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_GENEVE; return bnxt_hwrm_tunnel_dst_port_free(bp, cmd); } static const struct udp_tunnel_nic_info bnxt_udp_tunnels = { - .sync_table = bnxt_udp_tunnel_sync, + .set_port = bnxt_udp_tunnel_set_port, + .unset_port = bnxt_udp_tunnel_unset_port, .flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP | UDP_TUNNEL_NIC_INFO_OPEN_ONLY, .tables = { -- 2.43.0
1 0
0 0
[PATCH openEuler-22.03-LTS-SP1 4/6] bnxt_en: Query default VLAN before VNIC setup on a VF
by Baogen Shang 14 Mar '24

14 Mar '24
From: Somnath Kotur <somnath.kotur(a)broadcom.com> stable inclusion from stable-v5.10.184 commit deead0d8729f33f47cbedd0010a7e0e381527f9b category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8L4MY Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id… -------------------------------- [ Upstream commit 1a9e4f501bc6ff1b6ecb60df54fbf2b54db43bfe ] We need to call bnxt_hwrm_func_qcfg() on a VF to query the default VLAN that may be setup by the PF. If a default VLAN is enabled, the VF cannot support VLAN acceleration on the receive side and the VNIC must be setup to strip out the default VLAN tag. If a default VLAN is not enabled, the VF can support VLAN acceleration on the receive side. The VNIC should be set up to strip or not strip the VLAN based on the RX VLAN acceleration setting. Without this call to determine the default VLAN before calling bnxt_setup_vnic(), the VNIC may not be set up correctly. For example, bnxt_setup_vnic() may set up to strip the VLAN tag based on stale default VLAN information. If RX VLAN acceleration is not enabled, the VLAN tag will be incorrectly stripped and the RX data path will not work correctly. Fixes: cf6645f8ebc6 ("bnxt_en: Add function for VF driver to query default VLAN.") Reviewed-by: Pavan Chebbi <pavan.chebbi(a)broadcom.com> Signed-off-by: Somnath Kotur <somnath.kotur(a)broadcom.com> Signed-off-by: Michael Chan <michael.chan(a)broadcom.com> Signed-off-by: Paolo Abeni <pabeni(a)redhat.com> Signed-off-by: Sasha Levin <sashal(a)kernel.org> Signed-off-by: Dapeng Yu <dapeng.yu(a)windriver.com> --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index b818d5f342d5..4db84ed9d698 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -8336,6 +8336,9 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init) goto err_out; } + if (BNXT_VF(bp)) + bnxt_hwrm_func_qcfg(bp); + rc = bnxt_setup_vnic(bp, 0); if (rc) goto err_out; -- 2.43.0
1 0
0 0
[PATCH openEuler-22.03-LTS-SP1 3/6] bnxt_en: Don't issue AP reset during ethtool's reset operation
by Baogen Shang 14 Mar '24

14 Mar '24
From: Sreekanth Reddy <sreekanth.reddy(a)broadcom.com> stable inclusion from stable-v5.10.184 commit 84dbd27ad5dace21830c67d01470e9121a044b22 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8L4MY Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id… -------------------------------- [ Upstream commit 1d997801c7cc6a7f542e46d5a6bf16f893ad3fe9 ] Only older NIC controller's firmware uses the PROC AP reset type. Firmware on 5731X/5741X and newer chips does not support this reset type. When bnxt_reset() issues a series of resets, this PROC AP reset may actually fail on these newer chips because the firmware is not ready to accept this unsupported command yet. Avoid this unnecessary error by skipping this reset type on chips that don't support it. Fixes: 7a13240e3718 ("bnxt_en: fix ethtool_reset_flags ABI violations") Reviewed-by: Pavan Chebbi <pavan.chebbi(a)broadcom.com> Signed-off-by: Sreekanth Reddy <sreekanth.reddy(a)broadcom.com> Signed-off-by: Michael Chan <michael.chan(a)broadcom.com> Signed-off-by: Paolo Abeni <pabeni(a)redhat.com> Signed-off-by: Sasha Levin <sashal(a)kernel.org> Signed-off-by: Dapeng Yu <dapeng.yu(a)windriver.com> --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index d90b7b85c052..310c1d72205f 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -3446,7 +3446,7 @@ static int bnxt_reset(struct net_device *dev, u32 *flags) } } - if (req & BNXT_FW_RESET_AP) { + if (!BNXT_CHIP_P4_PLUS(bp) && (req & BNXT_FW_RESET_AP)) { /* This feature is not supported in older firmware versions */ if (bp->hwrm_spec_code >= 0x10803) { if (!bnxt_firmware_reset_ap(dev)) { -- 2.43.0
1 0
0 0
[PATCH openEuler-22.03-LTS-SP1 2/6] net: bcmgenet: Restore phy_stop() depending upon suspend/close
by Baogen Shang 14 Mar '24

14 Mar '24
From: Florian Fainelli <f.fainelli(a)gmail.com> stable inclusion from stable-v5.10.181 commit 43f6575004e0bbe0acc5d7a1955f326b22f38121 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8L4MY Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id… -------------------------------- [ Upstream commit 225c657945c4a6307741cb3cc89467eadcc26e9b ] Removing the phy_stop() from bcmgenet_netif_stop() ended up causing warnings from the PHY library that phy_start() is called from the RUNNING state since we are no longer stopping the PHY state machine during bcmgenet_suspend(). Restore the call to phy_stop() but make it conditional on being called from the close or suspend path. Fixes: c96e731c93ff ("net: bcmgenet: connect and disconnect from the PHY state machine") Fixes: 93e0401e0fc0 ("net: bcmgenet: Remove phy_stop() from bcmgenet_netif_stop()") Signed-off-by: Florian Fainelli <f.fainelli(a)gmail.com> Reviewed-by: Pavan Chebbi <pavan.chebbi(a)broadcom.com> Link: https://lore.kernel.org/r/20230515025608.2587012-1-f.fainelli@gmail.com Signed-off-by: Paolo Abeni <pabeni(a)redhat.com> Signed-off-by: Sasha Levin <sashal(a)kernel.org> Signed-off-by: Dapeng Yu <dapeng.yu(a)windriver.com> --- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 52c93701a9e4..f198144a7ce1 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -3393,7 +3393,7 @@ static int bcmgenet_open(struct net_device *dev) return ret; } -static void bcmgenet_netif_stop(struct net_device *dev) +static void bcmgenet_netif_stop(struct net_device *dev, bool stop_phy) { struct bcmgenet_priv *priv = netdev_priv(dev); @@ -3408,6 +3408,8 @@ static void bcmgenet_netif_stop(struct net_device *dev) /* Disable MAC transmit. TX DMA disabled must be done before this */ umac_enable_set(priv, CMD_TX_EN, false); + if (stop_phy) + phy_stop(dev->phydev); bcmgenet_disable_rx_napi(priv); bcmgenet_intr_disable(priv); @@ -3433,7 +3435,7 @@ static int bcmgenet_close(struct net_device *dev) netif_dbg(priv, ifdown, dev, "bcmgenet_close\n"); - bcmgenet_netif_stop(dev); + bcmgenet_netif_stop(dev, false); /* Really kill the PHY state machine and disconnect from it */ phy_disconnect(dev->phydev); @@ -4235,7 +4237,7 @@ static int bcmgenet_suspend(struct device *d) netif_device_detach(dev); - bcmgenet_netif_stop(dev); + bcmgenet_netif_stop(dev, true); if (!device_may_wakeup(d)) phy_suspend(dev->phydev); -- 2.43.0
1 0
0 0
[PATCH openEuler-22.03-LTS-SP1 1/6] net: bcmgenet: Remove phy_stop() from bcmgenet_netif_stop()
by Baogen Shang 14 Mar '24

14 Mar '24
From: Florian Fainelli <f.fainelli(a)gmail.com> stable inclusion from stable-v5.10.181 commit e92727ed9e8b6798efc1e7ae44bbe7c44c453670 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8L4MY Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id… -------------------------------- [ Upstream commit 93e0401e0fc0c54b0ac05b687cd135c2ac38187c ] The call to phy_stop() races with the later call to phy_disconnect(), resulting in concurrent phy_suspend() calls being run from different CPUs. The final call to phy_disconnect() ensures that the PHY is stopped and suspended, too. Fixes: c96e731c93ff ("net: bcmgenet: connect and disconnect from the PHY state machine") Signed-off-by: Florian Fainelli <f.fainelli(a)gmail.com> Signed-off-by: David S. Miller <davem(a)davemloft.net> Signed-off-by: Sasha Levin <sashal(a)kernel.org> Signed-off-by: Dapeng Yu <dapeng.yu(a)windriver.com> --- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 6ee6c34f28f2..52c93701a9e4 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -3408,7 +3408,6 @@ static void bcmgenet_netif_stop(struct net_device *dev) /* Disable MAC transmit. TX DMA disabled must be done before this */ umac_enable_set(priv, CMD_TX_EN, false); - phy_stop(dev->phydev); bcmgenet_disable_rx_napi(priv); bcmgenet_intr_disable(priv); -- 2.43.0
1 0
0 0
[PATCH openEuler-22.03-LTS-SP1 0/6] Upgrade driver for Broadcom NIC BCM57414
by Baogen Shang 14 Mar '24

14 Mar '24
From: Dapeng Yu <dapeng.yu(a)windriver.com> Upgrade driver for Broadcom NIC BCM57414 Florian Fainelli (2): net: bcmgenet: Remove phy_stop() from bcmgenet_netif_stop() net: bcmgenet: Restore phy_stop() depending upon suspend/close Somnath Kotur (2): bnxt_en: Query default VLAN before VNIC setup on a VF bnxt_en: Implement .set_port / .unset_port UDP tunnel callbacks Sreekanth Reddy (1): bnxt_en: Don't issue AP reset during ethtool's reset operation Tobias Heider (1): Add MODULE_FIRMWARE() for FIRMWARE_TG357766. drivers/net/ethernet/broadcom/bnxt/bnxt.c | 28 ++++++++++++++----- .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +- .../net/ethernet/broadcom/genet/bcmgenet.c | 9 +++--- drivers/net/ethernet/broadcom/tg3.c | 1 + 4 files changed, 28 insertions(+), 12 deletions(-) -- 2.43.0
1 0
0 0
[openeuler:OLK-5.10 333/30000] crypto/asymmetric_keys/pgp_public_key.c:35:27: error: field has incomplete type 'struct pgp_parse_context'
by kernel test robot 14 Mar '24

14 Mar '24
tree: https://gitee.com/openeuler/kernel.git OLK-5.10 head: 9e82708a746dc5d4ec8995a3e6edace2cf23c6fd commit: c283657144c1475e571f0c1f34477af1f682a12f [333/30000] KEYS: Provide a function to load keys from a PGP keyring blob config: x86_64-buildonly-randconfig-003-20240314 (https://download.01.org/0day-ci/archive/20240314/202403141305.rj6VMLiN-lkp@…) compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240314/202403141305.rj6VMLiN-lkp@…) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp(a)intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202403141305.rj6VMLiN-lkp@intel.com/ All error/warnings (new ones prefixed by >>): >> crypto/asymmetric_keys/pgp_public_key.c:35:27: error: field has incomplete type 'struct pgp_parse_context' 35 | struct pgp_parse_context pgp; | ^ crypto/asymmetric_keys/pgp_public_key.c:35:9: note: forward declaration of 'struct pgp_parse_context' 35 | struct pgp_parse_context pgp; | ^ >> crypto/asymmetric_keys/pgp_public_key.c:48:18: warning: declaration of 'struct pgp_parse_pubkey' will not be visible outside of this function [-Wvisibility] 48 | struct pgp_parse_pubkey *pgp, | ^ >> crypto/asymmetric_keys/pgp_public_key.c:63:10: error: incomplete definition of type 'struct pgp_parse_pubkey' 63 | n = (pgp->version < PGP_KEY_VERSION_4) ? 8 : 6; | ~~~^ crypto/asymmetric_keys/pgp_public_key.c:48:18: note: forward declaration of 'struct pgp_parse_pubkey' 48 | struct pgp_parse_pubkey *pgp, | ^ crypto/asymmetric_keys/pgp_public_key.c:85:25: error: incomplete definition of type 'struct pgp_parse_pubkey' 85 | digest_putc(digest, pgp->version); | ~~~^ crypto/asymmetric_keys/pgp_public_key.c:48:18: note: forward declaration of 'struct pgp_parse_pubkey' 48 | struct pgp_parse_pubkey *pgp, | ^ crypto/asymmetric_keys/pgp_public_key.c:87:11: error: incomplete definition of type 'struct pgp_parse_pubkey' 87 | a32 = pgp->creation_time; | ~~~^ crypto/asymmetric_keys/pgp_public_key.c:48:18: note: forward declaration of 'struct pgp_parse_pubkey' 48 | struct pgp_parse_pubkey *pgp, | ^ crypto/asymmetric_keys/pgp_public_key.c:93:9: error: incomplete definition of type 'struct pgp_parse_pubkey' 93 | if (pgp->version < PGP_KEY_VERSION_4) { | ~~~^ crypto/asymmetric_keys/pgp_public_key.c:48:18: note: forward declaration of 'struct pgp_parse_pubkey' 48 | struct pgp_parse_pubkey *pgp, | ^ crypto/asymmetric_keys/pgp_public_key.c:96:10: error: incomplete definition of type 'struct pgp_parse_pubkey' 96 | if (pgp->expires_at) | ~~~^ crypto/asymmetric_keys/pgp_public_key.c:48:18: note: forward declaration of 'struct pgp_parse_pubkey' 48 | struct pgp_parse_pubkey *pgp, | ^ crypto/asymmetric_keys/pgp_public_key.c:97:14: error: incomplete definition of type 'struct pgp_parse_pubkey' 97 | a16 = (pgp->expires_at - pgp->creation_time) / 86400UL; | ~~~^ crypto/asymmetric_keys/pgp_public_key.c:48:18: note: forward declaration of 'struct pgp_parse_pubkey' 48 | struct pgp_parse_pubkey *pgp, | ^ crypto/asymmetric_keys/pgp_public_key.c:97:32: error: incomplete definition of type 'struct pgp_parse_pubkey' 97 | a16 = (pgp->expires_at - pgp->creation_time) / 86400UL; | ~~~^ crypto/asymmetric_keys/pgp_public_key.c:48:18: note: forward declaration of 'struct pgp_parse_pubkey' 48 | struct pgp_parse_pubkey *pgp, | ^ crypto/asymmetric_keys/pgp_public_key.c:104:25: error: incomplete definition of type 'struct pgp_parse_pubkey' 104 | digest_putc(digest, pgp->pubkey_algo); | ~~~^ crypto/asymmetric_keys/pgp_public_key.c:48:18: note: forward declaration of 'struct pgp_parse_pubkey' 48 | struct pgp_parse_pubkey *pgp, | ^ crypto/asymmetric_keys/pgp_public_key.c:121:16: warning: declaration of 'struct pgp_parse_pubkey' will not be visible outside of this function [-Wvisibility] 121 | struct pgp_parse_pubkey *pgp, | ^ crypto/asymmetric_keys/pgp_public_key.c:132:30: error: incomplete definition of type 'struct pgp_parse_pubkey' 132 | tfm = crypto_alloc_shash(pgp->version < PGP_KEY_VERSION_4 ? | ~~~^ crypto/asymmetric_keys/pgp_public_key.c:121:16: note: forward declaration of 'struct pgp_parse_pubkey' 121 | struct pgp_parse_pubkey *pgp, | ^ >> crypto/asymmetric_keys/pgp_public_key.c:148:36: error: incompatible pointer types passing 'struct pgp_parse_pubkey *' to parameter of type 'struct pgp_parse_pubkey *' [-Werror,-Wincompatible-pointer-types] 148 | ret = pgp_calc_pkey_keyid(digest, pgp, pub); | ^~~ crypto/asymmetric_keys/pgp_public_key.c:48:36: note: passing argument to parameter 'pgp' here 48 | struct pgp_parse_pubkey *pgp, | ^ >> crypto/asymmetric_keys/pgp_public_key.c:201:26: error: variable has incomplete type 'struct pgp_parse_pubkey' 201 | struct pgp_parse_pubkey pgp; | ^ crypto/asymmetric_keys/pgp_public_key.c:201:9: note: forward declaration of 'struct pgp_parse_pubkey' 201 | struct pgp_parse_pubkey pgp; | ^ >> crypto/asymmetric_keys/pgp_public_key.c:224:8: error: implicit declaration of function 'pgp_parse_public_key' [-Werror,-Wimplicit-function-declaration] 224 | ret = pgp_parse_public_key(&data, &datalen, &pgp); | ^ crypto/asymmetric_keys/pgp_public_key.c:224:8: note: did you mean 'pgp_process_public_key'? crypto/asymmetric_keys/pgp_public_key.c:192:12: note: 'pgp_process_public_key' declared here 192 | static int pgp_process_public_key(struct pgp_parse_context *context, | ^ >> crypto/asymmetric_keys/pgp_public_key.c:310:8: error: implicit declaration of function 'pgp_parse_packets' [-Werror,-Wimplicit-function-declaration] 310 | ret = pgp_parse_packets(prep->data, prep->datalen, &ctx.pgp); | ^ 2 warnings and 14 errors generated. -- >> crypto/asymmetric_keys/pgp_preload.c:23:27: error: field has incomplete type 'struct pgp_parse_context' 23 | struct pgp_parse_context pgp; | ^ crypto/asymmetric_keys/pgp_preload.c:23:9: note: forward declaration of 'struct pgp_parse_context' 23 | struct pgp_parse_context pgp; | ^ >> crypto/asymmetric_keys/pgp_preload.c:110:8: error: implicit declaration of function 'pgp_parse_packets' [-Werror,-Wimplicit-function-declaration] 110 | ret = pgp_parse_packets(pgpdata, pgpdatalen, &ctx.pgp); | ^ 2 errors generated. Kconfig warnings: (for reference only) WARNING: unmet direct dependencies detected for PGP_KEY_PARSER Depends on [n]: CRYPTO [=y] && ASYMMETRIC_KEY_TYPE [=y] && ASYMMETRIC_PUBLIC_KEY_SUBTYPE [=n] Selected by [y]: - PGP_PRELOAD [=y] && CRYPTO [=y] && ASYMMETRIC_KEY_TYPE [=y] vim +35 crypto/asymmetric_keys/pgp_public_key.c 4006f47d4e2171 Roberto Sassu 2021-03-03 33 4006f47d4e2171 Roberto Sassu 2021-03-03 34 struct pgp_key_data_parse_context { 4006f47d4e2171 Roberto Sassu 2021-03-03 @35 struct pgp_parse_context pgp; 4006f47d4e2171 Roberto Sassu 2021-03-03 36 struct public_key *pub; 4006f47d4e2171 Roberto Sassu 2021-03-03 37 unsigned char *raw_fingerprint; 4006f47d4e2171 Roberto Sassu 2021-03-03 38 char *fingerprint; a98cb7a4b757b7 David Howells 2021-03-03 39 const char *user_id; a98cb7a4b757b7 David Howells 2021-03-03 40 size_t user_id_len; a98cb7a4b757b7 David Howells 2021-03-03 41 size_t fingerprint_len; 4006f47d4e2171 Roberto Sassu 2021-03-03 42 }; 4006f47d4e2171 Roberto Sassu 2021-03-03 43 4006f47d4e2171 Roberto Sassu 2021-03-03 44 /* 4006f47d4e2171 Roberto Sassu 2021-03-03 45 * Calculate the public key ID (RFC4880 12.2) 4006f47d4e2171 Roberto Sassu 2021-03-03 46 */ 4006f47d4e2171 Roberto Sassu 2021-03-03 47 static int pgp_calc_pkey_keyid(struct shash_desc *digest, 4006f47d4e2171 Roberto Sassu 2021-03-03 @48 struct pgp_parse_pubkey *pgp, 4006f47d4e2171 Roberto Sassu 2021-03-03 49 struct public_key *pub) 4006f47d4e2171 Roberto Sassu 2021-03-03 50 { 4006f47d4e2171 Roberto Sassu 2021-03-03 51 unsigned int nb[MAX_MPI]; 4006f47d4e2171 Roberto Sassu 2021-03-03 52 unsigned int nn[MAX_MPI]; 4006f47d4e2171 Roberto Sassu 2021-03-03 53 unsigned int n; 4006f47d4e2171 Roberto Sassu 2021-03-03 54 size_t keylen = pub->keylen; 4006f47d4e2171 Roberto Sassu 2021-03-03 55 u8 *key_ptr = pub->key; 4006f47d4e2171 Roberto Sassu 2021-03-03 56 u8 *pp[MAX_MPI]; 4006f47d4e2171 Roberto Sassu 2021-03-03 57 u32 a32; 4006f47d4e2171 Roberto Sassu 2021-03-03 58 int npkey; 4006f47d4e2171 Roberto Sassu 2021-03-03 59 int i, ret; 4006f47d4e2171 Roberto Sassu 2021-03-03 60 4006f47d4e2171 Roberto Sassu 2021-03-03 61 kenter(""); 4006f47d4e2171 Roberto Sassu 2021-03-03 62 4006f47d4e2171 Roberto Sassu 2021-03-03 @63 n = (pgp->version < PGP_KEY_VERSION_4) ? 8 : 6; 4006f47d4e2171 Roberto Sassu 2021-03-03 64 for (i = 0; i < MAX_MPI && keylen > 0; i++) { 4006f47d4e2171 Roberto Sassu 2021-03-03 65 ret = mpi_key_length(key_ptr, keylen, nb + i, nn + i); 4006f47d4e2171 Roberto Sassu 2021-03-03 66 if (ret < 0) 4006f47d4e2171 Roberto Sassu 2021-03-03 67 return ret; 4006f47d4e2171 Roberto Sassu 2021-03-03 68 4006f47d4e2171 Roberto Sassu 2021-03-03 69 pp[i] = key_ptr + 2; 4006f47d4e2171 Roberto Sassu 2021-03-03 70 key_ptr += 2 + nn[i]; 4006f47d4e2171 Roberto Sassu 2021-03-03 71 keylen -= 2 + nn[i]; 4006f47d4e2171 Roberto Sassu 2021-03-03 72 n += 2 + nn[i]; 4006f47d4e2171 Roberto Sassu 2021-03-03 73 } 4006f47d4e2171 Roberto Sassu 2021-03-03 74 4006f47d4e2171 Roberto Sassu 2021-03-03 75 if (keylen != 0) { 4006f47d4e2171 Roberto Sassu 2021-03-03 76 pr_debug("excess %zu\n", keylen); 4006f47d4e2171 Roberto Sassu 2021-03-03 77 return -EBADMSG; 4006f47d4e2171 Roberto Sassu 2021-03-03 78 } 4006f47d4e2171 Roberto Sassu 2021-03-03 79 4006f47d4e2171 Roberto Sassu 2021-03-03 80 npkey = i; 4006f47d4e2171 Roberto Sassu 2021-03-03 81 4006f47d4e2171 Roberto Sassu 2021-03-03 82 digest_putc(digest, 0x99); /* ctb */ 4006f47d4e2171 Roberto Sassu 2021-03-03 83 digest_putc(digest, n >> 8); /* 16-bit header length */ 4006f47d4e2171 Roberto Sassu 2021-03-03 84 digest_putc(digest, n); 4006f47d4e2171 Roberto Sassu 2021-03-03 85 digest_putc(digest, pgp->version); 4006f47d4e2171 Roberto Sassu 2021-03-03 86 4006f47d4e2171 Roberto Sassu 2021-03-03 87 a32 = pgp->creation_time; 4006f47d4e2171 Roberto Sassu 2021-03-03 88 digest_putc(digest, a32 >> 24); 4006f47d4e2171 Roberto Sassu 2021-03-03 89 digest_putc(digest, a32 >> 16); 4006f47d4e2171 Roberto Sassu 2021-03-03 90 digest_putc(digest, a32 >> 8); 4006f47d4e2171 Roberto Sassu 2021-03-03 91 digest_putc(digest, a32 >> 0); 4006f47d4e2171 Roberto Sassu 2021-03-03 92 4006f47d4e2171 Roberto Sassu 2021-03-03 93 if (pgp->version < PGP_KEY_VERSION_4) { 4006f47d4e2171 Roberto Sassu 2021-03-03 94 u16 a16; 4006f47d4e2171 Roberto Sassu 2021-03-03 95 4006f47d4e2171 Roberto Sassu 2021-03-03 96 if (pgp->expires_at) 4006f47d4e2171 Roberto Sassu 2021-03-03 97 a16 = (pgp->expires_at - pgp->creation_time) / 86400UL; 4006f47d4e2171 Roberto Sassu 2021-03-03 98 else 4006f47d4e2171 Roberto Sassu 2021-03-03 99 a16 = 0; 4006f47d4e2171 Roberto Sassu 2021-03-03 100 digest_putc(digest, a16 >> 8); 4006f47d4e2171 Roberto Sassu 2021-03-03 101 digest_putc(digest, a16 >> 0); 4006f47d4e2171 Roberto Sassu 2021-03-03 102 } 4006f47d4e2171 Roberto Sassu 2021-03-03 103 4006f47d4e2171 Roberto Sassu 2021-03-03 104 digest_putc(digest, pgp->pubkey_algo); 4006f47d4e2171 Roberto Sassu 2021-03-03 105 4006f47d4e2171 Roberto Sassu 2021-03-03 106 for (i = 0; i < npkey; i++) { 4006f47d4e2171 Roberto Sassu 2021-03-03 107 digest_putc(digest, nb[i] >> 8); 4006f47d4e2171 Roberto Sassu 2021-03-03 108 digest_putc(digest, nb[i]); 4006f47d4e2171 Roberto Sassu 2021-03-03 109 crypto_shash_update(digest, pp[i], nn[i]); 4006f47d4e2171 Roberto Sassu 2021-03-03 110 } 4006f47d4e2171 Roberto Sassu 2021-03-03 111 ret = 0; 4006f47d4e2171 Roberto Sassu 2021-03-03 112 4006f47d4e2171 Roberto Sassu 2021-03-03 113 kleave(" = %d", ret); 4006f47d4e2171 Roberto Sassu 2021-03-03 114 return ret; 4006f47d4e2171 Roberto Sassu 2021-03-03 115 } 4006f47d4e2171 Roberto Sassu 2021-03-03 116 4006f47d4e2171 Roberto Sassu 2021-03-03 117 /* 4006f47d4e2171 Roberto Sassu 2021-03-03 118 * Calculate the public key ID fingerprint 4006f47d4e2171 Roberto Sassu 2021-03-03 119 */ 4006f47d4e2171 Roberto Sassu 2021-03-03 120 static int pgp_generate_fingerprint(struct pgp_key_data_parse_context *ctx, 4006f47d4e2171 Roberto Sassu 2021-03-03 @121 struct pgp_parse_pubkey *pgp, 4006f47d4e2171 Roberto Sassu 2021-03-03 122 struct public_key *pub) 4006f47d4e2171 Roberto Sassu 2021-03-03 123 { 4006f47d4e2171 Roberto Sassu 2021-03-03 124 struct crypto_shash *tfm; 4006f47d4e2171 Roberto Sassu 2021-03-03 125 struct shash_desc *digest; 4006f47d4e2171 Roberto Sassu 2021-03-03 126 char *fingerprint; 4006f47d4e2171 Roberto Sassu 2021-03-03 127 u8 *raw_fingerprint; 4006f47d4e2171 Roberto Sassu 2021-03-03 128 int digest_size, offset; 4006f47d4e2171 Roberto Sassu 2021-03-03 129 int ret, i; 4006f47d4e2171 Roberto Sassu 2021-03-03 130 4006f47d4e2171 Roberto Sassu 2021-03-03 131 ret = -ENOMEM; 4006f47d4e2171 Roberto Sassu 2021-03-03 132 tfm = crypto_alloc_shash(pgp->version < PGP_KEY_VERSION_4 ? 4006f47d4e2171 Roberto Sassu 2021-03-03 133 "md5" : "sha1", 0, 0); 4006f47d4e2171 Roberto Sassu 2021-03-03 134 if (!tfm) 4006f47d4e2171 Roberto Sassu 2021-03-03 135 goto cleanup; 4006f47d4e2171 Roberto Sassu 2021-03-03 136 4006f47d4e2171 Roberto Sassu 2021-03-03 137 digest = kmalloc(sizeof(*digest) + crypto_shash_descsize(tfm), 4006f47d4e2171 Roberto Sassu 2021-03-03 138 GFP_KERNEL); 4006f47d4e2171 Roberto Sassu 2021-03-03 139 if (!digest) 4006f47d4e2171 Roberto Sassu 2021-03-03 140 goto cleanup_tfm; 4006f47d4e2171 Roberto Sassu 2021-03-03 141 4006f47d4e2171 Roberto Sassu 2021-03-03 142 digest->tfm = tfm; 4006f47d4e2171 Roberto Sassu 2021-03-03 143 crypto_shash_set_flags(digest->tfm, CRYPTO_TFM_REQ_MAY_SLEEP); 4006f47d4e2171 Roberto Sassu 2021-03-03 144 ret = crypto_shash_init(digest); 4006f47d4e2171 Roberto Sassu 2021-03-03 145 if (ret < 0) 4006f47d4e2171 Roberto Sassu 2021-03-03 146 goto cleanup_hash; 4006f47d4e2171 Roberto Sassu 2021-03-03 147 4006f47d4e2171 Roberto Sassu 2021-03-03 @148 ret = pgp_calc_pkey_keyid(digest, pgp, pub); 4006f47d4e2171 Roberto Sassu 2021-03-03 149 if (ret < 0) 4006f47d4e2171 Roberto Sassu 2021-03-03 150 goto cleanup_hash; 4006f47d4e2171 Roberto Sassu 2021-03-03 151 4006f47d4e2171 Roberto Sassu 2021-03-03 152 digest_size = crypto_shash_digestsize(tfm); 4006f47d4e2171 Roberto Sassu 2021-03-03 153 4006f47d4e2171 Roberto Sassu 2021-03-03 154 raw_fingerprint = kmalloc(digest_size, GFP_KERNEL); 4006f47d4e2171 Roberto Sassu 2021-03-03 155 if (!raw_fingerprint) 4006f47d4e2171 Roberto Sassu 2021-03-03 156 goto cleanup_hash; 4006f47d4e2171 Roberto Sassu 2021-03-03 157 4006f47d4e2171 Roberto Sassu 2021-03-03 158 ret = crypto_shash_final(digest, raw_fingerprint); 4006f47d4e2171 Roberto Sassu 2021-03-03 159 if (ret < 0) 4006f47d4e2171 Roberto Sassu 2021-03-03 160 goto cleanup_raw_fingerprint; 4006f47d4e2171 Roberto Sassu 2021-03-03 161 a98cb7a4b757b7 David Howells 2021-03-03 162 ctx->fingerprint_len = digest_size * 2; 4006f47d4e2171 Roberto Sassu 2021-03-03 163 fingerprint = kmalloc(digest_size * 2 + 1, GFP_KERNEL); 4006f47d4e2171 Roberto Sassu 2021-03-03 164 if (!fingerprint) 4006f47d4e2171 Roberto Sassu 2021-03-03 165 goto cleanup_raw_fingerprint; 4006f47d4e2171 Roberto Sassu 2021-03-03 166 4006f47d4e2171 Roberto Sassu 2021-03-03 167 offset = digest_size - 8; 4006f47d4e2171 Roberto Sassu 2021-03-03 168 pr_debug("offset %u/%u\n", offset, digest_size); 4006f47d4e2171 Roberto Sassu 2021-03-03 169 4006f47d4e2171 Roberto Sassu 2021-03-03 170 for (i = 0; i < digest_size; i++) 4006f47d4e2171 Roberto Sassu 2021-03-03 171 sprintf(fingerprint + i * 2, "%02x", raw_fingerprint[i]); 4006f47d4e2171 Roberto Sassu 2021-03-03 172 pr_debug("fingerprint %s\n", fingerprint); 4006f47d4e2171 Roberto Sassu 2021-03-03 173 4006f47d4e2171 Roberto Sassu 2021-03-03 174 ctx->raw_fingerprint = raw_fingerprint; 4006f47d4e2171 Roberto Sassu 2021-03-03 175 ctx->fingerprint = fingerprint; 4006f47d4e2171 Roberto Sassu 2021-03-03 176 ret = 0; 4006f47d4e2171 Roberto Sassu 2021-03-03 177 cleanup_raw_fingerprint: 4006f47d4e2171 Roberto Sassu 2021-03-03 178 if (ret < 0) 4006f47d4e2171 Roberto Sassu 2021-03-03 179 kfree(raw_fingerprint); 4006f47d4e2171 Roberto Sassu 2021-03-03 180 cleanup_hash: 4006f47d4e2171 Roberto Sassu 2021-03-03 181 kfree(digest); 4006f47d4e2171 Roberto Sassu 2021-03-03 182 cleanup_tfm: 4006f47d4e2171 Roberto Sassu 2021-03-03 183 crypto_free_shash(tfm); 4006f47d4e2171 Roberto Sassu 2021-03-03 184 cleanup: 4006f47d4e2171 Roberto Sassu 2021-03-03 185 kleave(" = %d", ret); 4006f47d4e2171 Roberto Sassu 2021-03-03 186 return ret; 4006f47d4e2171 Roberto Sassu 2021-03-03 187 } 4006f47d4e2171 Roberto Sassu 2021-03-03 188 4006f47d4e2171 Roberto Sassu 2021-03-03 189 /* 4006f47d4e2171 Roberto Sassu 2021-03-03 190 * Extract a public key or public subkey from the PGP stream. 4006f47d4e2171 Roberto Sassu 2021-03-03 191 */ 4006f47d4e2171 Roberto Sassu 2021-03-03 192 static int pgp_process_public_key(struct pgp_parse_context *context, 4006f47d4e2171 Roberto Sassu 2021-03-03 193 enum pgp_packet_tag type, 4006f47d4e2171 Roberto Sassu 2021-03-03 194 u8 headerlen, 4006f47d4e2171 Roberto Sassu 2021-03-03 195 const u8 *data, 4006f47d4e2171 Roberto Sassu 2021-03-03 196 size_t datalen) 4006f47d4e2171 Roberto Sassu 2021-03-03 197 { 4006f47d4e2171 Roberto Sassu 2021-03-03 198 const char *algo; 4006f47d4e2171 Roberto Sassu 2021-03-03 199 struct pgp_key_data_parse_context *ctx = 4006f47d4e2171 Roberto Sassu 2021-03-03 200 container_of(context, struct pgp_key_data_parse_context, pgp); 4006f47d4e2171 Roberto Sassu 2021-03-03 @201 struct pgp_parse_pubkey pgp; 4006f47d4e2171 Roberto Sassu 2021-03-03 202 struct public_key *pub; 4006f47d4e2171 Roberto Sassu 2021-03-03 203 int ret; 4006f47d4e2171 Roberto Sassu 2021-03-03 204 4006f47d4e2171 Roberto Sassu 2021-03-03 205 kenter(",%u,%u,,%zu", type, headerlen, datalen); 4006f47d4e2171 Roberto Sassu 2021-03-03 206 a98cb7a4b757b7 David Howells 2021-03-03 207 if (type == PGP_PKT_USER_ID) { a98cb7a4b757b7 David Howells 2021-03-03 208 ctx->user_id = data; a98cb7a4b757b7 David Howells 2021-03-03 209 ctx->user_id_len = datalen; a98cb7a4b757b7 David Howells 2021-03-03 210 kleave(" = 0 [user ID]"); a98cb7a4b757b7 David Howells 2021-03-03 211 return 0; a98cb7a4b757b7 David Howells 2021-03-03 212 } a98cb7a4b757b7 David Howells 2021-03-03 213 4006f47d4e2171 Roberto Sassu 2021-03-03 214 if (ctx->fingerprint) { 4006f47d4e2171 Roberto Sassu 2021-03-03 215 kleave(" = -ENOKEY [already]"); 4006f47d4e2171 Roberto Sassu 2021-03-03 216 return -EBADMSG; 4006f47d4e2171 Roberto Sassu 2021-03-03 217 } 4006f47d4e2171 Roberto Sassu 2021-03-03 218 4006f47d4e2171 Roberto Sassu 2021-03-03 219 pub = kzalloc(sizeof(struct public_key), GFP_KERNEL); 4006f47d4e2171 Roberto Sassu 2021-03-03 220 if (!pub) 4006f47d4e2171 Roberto Sassu 2021-03-03 221 return -ENOMEM; 4006f47d4e2171 Roberto Sassu 2021-03-03 222 pub->id_type = "PGP"; 4006f47d4e2171 Roberto Sassu 2021-03-03 223 4006f47d4e2171 Roberto Sassu 2021-03-03 @224 ret = pgp_parse_public_key(&data, &datalen, &pgp); 4006f47d4e2171 Roberto Sassu 2021-03-03 225 if (ret < 0) 4006f47d4e2171 Roberto Sassu 2021-03-03 226 goto cleanup; 4006f47d4e2171 Roberto Sassu 2021-03-03 227 4006f47d4e2171 Roberto Sassu 2021-03-03 228 if (pgp.pubkey_algo >= PGP_PUBKEY__LAST) 4006f47d4e2171 Roberto Sassu 2021-03-03 229 goto cleanup_unsupported_pkey_algo; 4006f47d4e2171 Roberto Sassu 2021-03-03 230 algo = pgp_to_public_key_algo[pgp.pubkey_algo]; 4006f47d4e2171 Roberto Sassu 2021-03-03 231 if (!algo) 4006f47d4e2171 Roberto Sassu 2021-03-03 232 goto cleanup_unsupported_pkey_algo; 4006f47d4e2171 Roberto Sassu 2021-03-03 233 pub->pkey_algo = algo; 4006f47d4e2171 Roberto Sassu 2021-03-03 234 4006f47d4e2171 Roberto Sassu 2021-03-03 235 pub->key = kmemdup(data, datalen, GFP_KERNEL); 4006f47d4e2171 Roberto Sassu 2021-03-03 236 if (!pub->key) 4006f47d4e2171 Roberto Sassu 2021-03-03 237 goto cleanup_nomem; 4006f47d4e2171 Roberto Sassu 2021-03-03 238 4006f47d4e2171 Roberto Sassu 2021-03-03 239 pub->keylen = datalen; 4006f47d4e2171 Roberto Sassu 2021-03-03 240 4006f47d4e2171 Roberto Sassu 2021-03-03 241 ret = pgp_generate_fingerprint(ctx, &pgp, pub); 4006f47d4e2171 Roberto Sassu 2021-03-03 242 if (ret < 0) 4006f47d4e2171 Roberto Sassu 2021-03-03 243 goto cleanup; 4006f47d4e2171 Roberto Sassu 2021-03-03 244 4006f47d4e2171 Roberto Sassu 2021-03-03 245 ctx->pub = pub; 4006f47d4e2171 Roberto Sassu 2021-03-03 246 kleave(" = 0 [use]"); 4006f47d4e2171 Roberto Sassu 2021-03-03 247 return 0; 4006f47d4e2171 Roberto Sassu 2021-03-03 248 4006f47d4e2171 Roberto Sassu 2021-03-03 249 cleanup_unsupported_pkey_algo: 4006f47d4e2171 Roberto Sassu 2021-03-03 250 pr_debug("Unsupported public key algorithm %u\n", 4006f47d4e2171 Roberto Sassu 2021-03-03 251 pgp.pubkey_algo); 4006f47d4e2171 Roberto Sassu 2021-03-03 252 ret = -ENOPKG; 4006f47d4e2171 Roberto Sassu 2021-03-03 253 goto cleanup; 4006f47d4e2171 Roberto Sassu 2021-03-03 254 cleanup_nomem: 4006f47d4e2171 Roberto Sassu 2021-03-03 255 ret = -ENOMEM; 4006f47d4e2171 Roberto Sassu 2021-03-03 256 goto cleanup; 4006f47d4e2171 Roberto Sassu 2021-03-03 257 cleanup: 4006f47d4e2171 Roberto Sassu 2021-03-03 258 pr_devel("cleanup"); 4006f47d4e2171 Roberto Sassu 2021-03-03 259 kfree(pub->key); 4006f47d4e2171 Roberto Sassu 2021-03-03 260 kfree(pub); 4006f47d4e2171 Roberto Sassu 2021-03-03 261 kleave(" = %d", ret); 4006f47d4e2171 Roberto Sassu 2021-03-03 262 return ret; 4006f47d4e2171 Roberto Sassu 2021-03-03 263 } 4006f47d4e2171 Roberto Sassu 2021-03-03 264 :::::: The code at line 35 was first introduced by commit :::::: 4006f47d4e2171af60bfb5daab2bcce8bc02c309 KEYS: PGP data parser :::::: TO: Roberto Sassu <roberto.sassu(a)huawei.com> :::::: CC: Zheng Zengkai <zhengzengkai(a)huawei.com> -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
1 0
0 0
[openeuler:OLK-5.10 25742/30000] drivers/soc/hisilicon/pbha.c:100:21: warning: variable 'ptent' set but not used
by kernel test robot 14 Mar '24

14 Mar '24
tree: https://gitee.com/openeuler/kernel.git OLK-5.10 head: 9e82708a746dc5d4ec8995a3e6edace2cf23c6fd commit: 6989680f878a16015e69291360e12cb9242e1360 [25742/30000] arm64: mm: Introduce procfs interface to update PBHA0 bit config: arm64-randconfig-002-20240312 (https://download.01.org/0day-ci/archive/20240314/202403141207.Ix7wfVox-lkp@…) compiler: aarch64-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240314/202403141207.Ix7wfVox-lkp@…) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp(a)intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202403141207.Ix7wfVox-lkp@intel.com/ All warnings (new ones prefixed by >>): drivers/soc/hisilicon/pbha.c: In function 'pbha_bit0_pte_range': >> drivers/soc/hisilicon/pbha.c:100:21: warning: variable 'ptent' set but not used [-Wunused-but-set-variable] 100 | pte_t *pte, ptent; | ^~~~~ vim +/ptent +100 drivers/soc/hisilicon/pbha.c 94 95 static int pbha_bit0_pte_range(pmd_t *pmd, unsigned long addr, 96 unsigned long end, struct mm_walk *walk) 97 { 98 int *op = (int *)walk->private; 99 struct vm_area_struct *vma = walk->vma; > 100 pte_t *pte, ptent; 101 spinlock_t *ptl; 102 bool set = (*op == SET_PBHA_BIT0_FLAG); 103 104 ptl = pmd_trans_huge_lock(pmd, vma); 105 if (ptl) { 106 pbha_bit0_update_pmd_bits(vma, addr, pmd, set); 107 108 spin_unlock(ptl); 109 return 0; 110 } 111 112 if (pmd_trans_unstable(pmd)) 113 return 0; 114 115 pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); 116 for (; addr != end; pte++, addr += PAGE_SIZE) { 117 ptent = *pte; 118 119 pbha_bit0_update_pte_bits(vma, addr, pte, set); 120 } 121 pte_unmap_unlock(pte - 1, ptl); 122 cond_resched(); 123 return 0; 124 } 125 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
1 0
0 0
[PATCH OLK-6.6] iommu/iova: avoid softlockup in fq_flush_timeout
by Zhang Zekun 14 Mar '24

14 Mar '24
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8ZE0I CVE: NA -------------------------------- There is a softlockup undering cpu pressure test. ... pc : _raw_spin_unlock_irqrestore+0x14/0x78 lr : fq_flush_timeout+0x94/0x118 ... Call trace: _raw_spin_unlock_irqrestore+0x14/0x78 call_timer_fn+0x3c/0x1d0 expire_timers+0xcc/0x190 run_timer_softirq+0xfc/0x268 __do_softirq+0x128/0x3dc ____do_softirq+0x18/0x30 call_on_irq_stack+0x24/0x30 do_softirq_own_stack+0x24/0x38 irq_exit_rcu+0xc0/0xe8 el1_interrupt+0x48/0xc0 el1h_64_irq_handler+0x18/0x28 el1h_64_irq+0x78/0x80 __schedule+0xf28/0x12a0 schedule+0x3c/0x108 schedule_timeout+0xa0/0x1d0 pktgen_thread_worker+0x1180/0x15d0 kthread+0x120/0x130 ret_from_fork+0x10/0x20 This is because the timer callback fq_flush_timeout may run more than 10ms, and timer may be processed continuously in the softirq so trigger softlockup. We can use work to deal with fq_ring_free for each cpu which may take long time, that to avoid triggering softlockup. Signed-off-by: Li Bin <huawei.libin(a)huawei.com> Signed-off-by: Peng Wu <wupeng58(a)huawei.com> Reviewed-By: Xie XiuQi <xiexiuqi(a)huawei.com> Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com> Reviewed-by: Cheng Jian <cj.chengjian(a)huawei.com> Signed-off-by: Zheng Zengkai <zhengzengkai(a)huawei.com> Signed-off-by: Zhang Zekun <zhangzekun11(a)huawei.com> --- drivers/iommu/dma-iommu.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 037fcf826407..58a90521630e 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -85,6 +85,8 @@ struct iommu_dma_cookie { /* Options for dma-iommu use */ struct iommu_dma_options options; struct mutex mutex; + + struct work_struct free_iova_work; }; static DEFINE_STATIC_KEY_FALSE(iommu_deferred_attach_enabled); @@ -184,17 +186,11 @@ static void fq_flush_iotlb(struct iommu_dma_cookie *cookie) static void fq_flush_timeout(struct timer_list *t) { struct iommu_dma_cookie *cookie = from_timer(cookie, t, fq_timer); - int cpu; atomic_set(&cookie->fq_timer_on, 0); fq_flush_iotlb(cookie); - if (cookie->options.qt == IOMMU_DMA_OPTS_SINGLE_QUEUE) { - fq_ring_free(cookie, cookie->single_fq); - } else { - for_each_possible_cpu(cpu) - fq_ring_free(cookie, per_cpu_ptr(cookie->percpu_fq, cpu)); - } + schedule_work(&cookie->free_iova_work); } static void queue_iova(struct iommu_dma_cookie *cookie, @@ -279,6 +275,7 @@ static void iommu_dma_free_fq(struct iommu_dma_cookie *cookie) return; del_timer_sync(&cookie->fq_timer); + flush_work(&cookie->free_iova_work); if (cookie->options.qt == IOMMU_DMA_OPTS_SINGLE_QUEUE) iommu_dma_free_fq_single(cookie->single_fq); else @@ -330,6 +327,20 @@ static int iommu_dma_init_fq_percpu(struct iommu_dma_cookie *cookie) return 0; } +static void free_iova_work_func(struct work_struct *work) +{ + struct iommu_dma_cookie *cookie = container_of(work, struct iommu_dma_cookie, free_iova_work); + int cpu; + + if (cookie->options.qt == IOMMU_DMA_OPTS_SINGLE_QUEUE) { + fq_ring_free(cookie, cookie->single_fq); + } else { + for_each_possible_cpu(cpu) + fq_ring_free(cookie, per_cpu_ptr(cookie->percpu_fq, cpu)); + } + +} + /* sysfs updates are serialised by the mutex of the group owning @domain */ int iommu_dma_init_fq(struct iommu_domain *domain) { @@ -352,6 +363,7 @@ int iommu_dma_init_fq(struct iommu_domain *domain) return -ENOMEM; } + INIT_WORK(&cookie->free_iova_work, free_iova_work_func); timer_setup(&cookie->fq_timer, fq_flush_timeout, 0); atomic_set(&cookie->fq_timer_on, 0); /* -- 2.17.1
2 1
0 0
  • ← Newer
  • 1
  • ...
  • 1246
  • 1247
  • 1248
  • 1249
  • 1250
  • 1251
  • 1252
  • ...
  • 1889
  • Older →

HyperKitty Powered by HyperKitty