diff --git a/backport-bus-peer-fix-catching-OOM-when-linking-match-rules.patch b/backport-bus-peer-fix-catching-OOM-when-linking-match-rules.patch new file mode 100644 index 0000000..e045554 --- /dev/null +++ b/backport-bus-peer-fix-catching-OOM-when-linking-match-rules.patch @@ -0,0 +1,45 @@ +From af6bf48ba27408725d14378e4a11139106506f3b Mon Sep 17 00:00:00 2001 +From: David Rheinsberg +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 + 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 +Signed-off-by: David Rheinsberg +--- + 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 + diff --git a/dbus-broker.spec b/dbus-broker.spec index fb279bc..4d4a890 100644 --- a/dbus-broker.spec +++ b/dbus-broker.spec @@ -1,6 +1,6 @@ Name: dbus-broker Version: 29 -Release: 6 +Release: 7 Summary: Linux D-Bus Message Broker License: Apache License 2.0 URL: https://github.com/bus1/dbus-broker @@ -10,6 +10,7 @@ Patch0001: backport-CVE-2022-31213.patch Patch0002: backport-CVE-2022-31212.patch Patch0003: enable-dbus-broker-to-reexecute.patch Patch0004: add-unit-test-for-dbus-broker.patch +Patch0005: backport-bus-peer-fix-catching-OOM-when-linking-match-rules.patch BuildRequires: cmake gcc glibc-devel meson python-docutils dbus BuildRequires: pkgconfig(expat) pkgconfig(libsystemd) pkgconfig(libselinux) @@ -87,6 +88,9 @@ fi %{_userunitdir}/dbus-broker.service %changelog +* Sun Jun 25 2023 hongjinghao - 29-7 +- sync patches from dbus-broker community + * Wed Jun 7 2023 hongjinghao - 29-6 - Enable dbus-broker to reexecute without disconnection