Skip to content

Commit 9c90c9b

Browse files
mkubecekklassert
authored andcommitted
Revert "net: af_key: add check for pfkey_broadcast in function pfkey_process"
This reverts commit 4dc2a5a. 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. v2: add a comment explaining why is the return value ignored Signed-off-by: Michal Kubecek <mkubecek@suse.cz> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
1 parent 8c3b8dc commit 9c90c9b

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

net/key/af_key.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2826,10 +2826,12 @@ static int pfkey_process(struct sock *sk, struct sk_buff *skb, const struct sadb
28262826
void *ext_hdrs[SADB_EXT_MAX];
28272827
int err;
28282828

2829-
err = pfkey_broadcast(skb_clone(skb, GFP_KERNEL), GFP_KERNEL,
2830-
BROADCAST_PROMISC_ONLY, NULL, sock_net(sk));
2831-
if (err)
2832-
return err;
2829+
/* Non-zero return value of pfkey_broadcast() does not always signal
2830+
* an error and even on an actual error we may still want to process
2831+
* the message so rather ignore the return value.
2832+
*/
2833+
pfkey_broadcast(skb_clone(skb, GFP_KERNEL), GFP_KERNEL,
2834+
BROADCAST_PROMISC_ONLY, NULL, sock_net(sk));
28332835

28342836
memset(ext_hdrs, 0, sizeof(ext_hdrs));
28352837
err = parse_exthdrs(skb, hdr, ext_hdrs);

0 commit comments

Comments
 (0)