]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-device-monitor: fix subsystem filter
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 22 Nov 2018 16:24:34 +0000 (01:24 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 22 Nov 2018 17:49:28 +0000 (02:49 +0900)
This fixes a bug introduced by 759d9f3f8d07af2940bb3783acc3985ee47adfa5.

Fixes #10882.

src/libsystemd/sd-device/device-monitor.c

index bb50257a0df4a1eb1836f77e7f07e166dada6d90..05e7ec07159bf83563710eafd77ba23384c5e23d 100644 (file)
@@ -648,13 +648,12 @@ _public_ int sd_device_monitor_filter_update(sd_device_monitor *m) {
                                 /* jump if subsystem does not match */
                                 bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1);
                         } else {
-                                hash = string_hash32(devtype);
-
                                 /* jump if subsystem does not match */
                                 bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 3);
                                 /* load device devtype value in A */
                                 bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(monitor_netlink_header, filter_devtype_hash));
                                 /* jump if value does not match */
+                                hash = string_hash32(devtype);
                                 bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1);
                         }