From nobody Tue May 7 16:56:33 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C33AAC433EF for ; Mon, 23 May 2022 16:02:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238470AbiEWQCB (ORCPT ); Mon, 23 May 2022 12:02:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238513AbiEWQBd (ORCPT ); Mon, 23 May 2022 12:01:33 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BACD8193F7; Mon, 23 May 2022 09:01:26 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 1B7B421B83; Mon, 23 May 2022 16:01:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1653321685; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc; bh=fi+V34PTkWcZoMwWtG2mVa3bYbZ61n1jXy1FWg8+OfA=; b=qkTWvOigKviuXOzACz+miEgbMCqrJEgK2Rkvn1kyMAuRDybQMaofRPWHhBB6LIse1Aq7V8 Nzm2QpBxCkK27n1rPgdL5j6RPt3hEhu3g7/E9fmfsaC2UbDOxBiKmvxe5yJ2DoHdqLsNo0 hPuKBmEbMU340r2kwtNWfggcyGkArs4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1653321685; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc; bh=fi+V34PTkWcZoMwWtG2mVa3bYbZ61n1jXy1FWg8+OfA=; b=BGbNCSotJVuECgCwOhKCmpNAuEZ0QJMVaI8dsNrVkK+Yw+LHkypAJEEUtoPBs6fOis/Nl/ r00N60Xj1bJJdeBw== Received: from lion.mk-sys.cz (unknown [10.100.200.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 0663A2C141; Mon, 23 May 2022 16:01:24 +0000 (UTC) Received: by lion.mk-sys.cz (Postfix, from userid 1000) id A413860294; Mon, 23 May 2022 18:01:24 +0200 (CEST) Message-Id: From: Michal Kubecek Subject: [PATCH ipsec] Revert "net: af_key: add check for pfkey_broadcast in function pfkey_process" To: Steffen Klassert , netdev@vger.kernel.org Cc: Jiasheng Jiang , Herbert Xu , "David S. Miller" , Jakub Kicinski , Eric Dumazet , Paolo Abeni , linux-kernel@vger.kernel.org Date: Mon, 23 May 2022 18:01:24 +0200 (CEST) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This reverts commit 4dc2a5a8f6754492180741facf2a8787f2c415d7. A non-zero return value from pfkey_broadcast() does not necessarily mean an error occurred as this function returns -ESRCH when no registered listener received the message. In particular, a call with BROADCAST_PROMISC_ONLY flag and null one_sk argument can never return zero so that this commit in fact prevents processing any PF_KEY message. One visible effect is that racoon daemon fails to find encryption algorithms like aes and refuses to start. Excluding -ESRCH return value would fix this but it's not obvious that we really want to bail out here and most other callers of pfkey_broadcast() also ignore the return value. Also, as pointed out by Steffen Klassert, PF_KEY is kind of deprecated and newer userspace code should use netlink instead so that we should only disturb the code for really important fixes. Signed-off-by: Michal Kubecek --- net/key/af_key.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/key/af_key.c b/net/key/af_key.c index 339d95df19d3..fbb2c16693ad 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -2826,10 +2826,8 @@ static int pfkey_process(struct sock *sk, struct sk_= buff *skb, const struct sadb void *ext_hdrs[SADB_EXT_MAX]; int err; =20 - err =3D pfkey_broadcast(skb_clone(skb, GFP_KERNEL), GFP_KERNEL, - BROADCAST_PROMISC_ONLY, NULL, sock_net(sk)); - if (err) - return err; + pfkey_broadcast(skb_clone(skb, GFP_KERNEL), GFP_KERNEL, + BROADCAST_PROMISC_ONLY, NULL, sock_net(sk)); =20 memset(ext_hdrs, 0, sizeof(ext_hdrs)); err =3D parse_exthdrs(skb, hdr, ext_hdrs); --=20 2.36.1