diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-05-06 19:29:39 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-05-06 19:51:21 +0200 |
commit | eba782d59bfc1ce82b4c41883d15fa5e705126e5 (patch) | |
tree | 9e79c363b864fa68270fa5c1982913c8520d71b6 /src/udev | |
parent | README: mention kernel requirement for ambient capabilities (diff) | |
download | systemd-eba782d59bfc1ce82b4c41883d15fa5e705126e5.tar.xz systemd-eba782d59bfc1ce82b4c41883d15fa5e705126e5.zip |
udev: fix parent token handling
This fixes a bug introduced by 03677889f0ef42cdc534bf3b31265a054b20a354.
Fixes #23288.
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/udev-rules.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index 1c20775f08..fa225476b6 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -2425,11 +2425,15 @@ static int udev_rule_apply_parent_token_to_event( UdevRuleToken *head; int r; - line = rules->current_file->current_line; - head = rules->current_file->current_line->current_token; - event->dev_parent = event->dev; + assert(rules); + assert(rules->current_file); + assert(event); + + line = ASSERT_PTR(rules->current_file->current_line); + head = ASSERT_PTR(rules->current_file->current_line->current_token); + event->dev_parent = ASSERT_PTR(event->dev); + for (;;) { - line->current_token = NULL; LIST_FOREACH(tokens, token, head) { if (!token_is_for_parents(token)) return true; /* All parent tokens match. */ @@ -2441,8 +2445,8 @@ static int udev_rule_apply_parent_token_to_event( if (r == 0) break; } - if (!line->current_token) - /* All parent tokens match. But no assign tokens in the line. Hmm... */ + if (r > 0) + /* All parent tokens match, and no more token (except for GOTO) in the line. */ return true; if (sd_device_get_parent(event->dev_parent, &event->dev_parent) < 0) { |