46 lines
1.8 KiB
Diff
46 lines
1.8 KiB
Diff
From af6bf48ba27408725d14378e4a11139106506f3b Mon Sep 17 00:00:00 2001
|
|
From: David Rheinsberg <david@readahead.eu>
|
|
Date: Mon, 12 Jun 2023 10:56:31 +0200
|
|
Subject: [PATCH] bus/peer: fix catching OOM when linking match-rules
|
|
|
|
When the match-rule infrastructure was extended to have per-key lookup
|
|
tables, all call-sites had to be amended to catch errors when linking
|
|
new rules. One such site was missed, so fix this and catch the error
|
|
properly.
|
|
|
|
The conversion was initially performed in:
|
|
|
|
commit 6c2b082522a6af033cd6699b669a4de614c41ad7
|
|
Author: Tom Gundersen <teg@jklm.no>
|
|
Date: Wed Apr 25 17:16:47 2018 +0200
|
|
|
|
match: make match_rule_link() fallible
|
|
|
|
This fixes a possible bug where ENOMEM is ignored and thus a match rule
|
|
is silently dropped instead of being linked and retained.
|
|
|
|
Reported-by: Mark Esler <mark.esler@canonical.com>
|
|
Signed-off-by: David Rheinsberg <david@readahead.eu>
|
|
---
|
|
src/bus/peer.c | 4 +++-
|
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/bus/peer.c b/src/bus/peer.c
|
|
index 1867223..9de3566 100644
|
|
--- a/src/bus/peer.c
|
|
+++ b/src/bus/peer.c
|
|
@@ -548,7 +548,9 @@ static int peer_link_match(Peer *peer, MatchRule *rule, bool monitor) {
|
|
case ADDRESS_TYPE_ID: {
|
|
sender = peer_registry_find_peer(&peer->bus->peers, addr.id);
|
|
if (sender) {
|
|
- match_rule_link(rule, &sender->sender_matches, monitor);
|
|
+ r = match_rule_link(rule, &sender->sender_matches, monitor);
|
|
+ if (r)
|
|
+ return error_fold(r);
|
|
} else if (addr.id >= peer->bus->peers.ids) {
|
|
/*
|
|
* This peer does not yet exist, by the same
|
|
--
|
|
2.33.0
|
|
|