sync patches from dbus-broker community

(cherry picked from commit b97c929f2c140dd789519c501582c4ccda16766d)
This commit is contained in:
hongjinghao 2023-06-25 09:49:42 +08:00 committed by openeuler-sync-bot
parent 8407c9f580
commit cb49d2fd7b
2 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,45 @@
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

View File

@ -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<hongjinghao@huawei.com> - 29-7
- sync patches from dbus-broker community
* Wed Jun 7 2023 hongjinghao<hongjinghao@huawei.com> - 29-6
- Enable dbus-broker to reexecute without disconnection