ac3a84
From 03bb31bbb875e20da7ae37eb44e98d244823e0e7 Mon Sep 17 00:00:00 2001
ac3a84
From: Yu Watanabe <watanabe.yu+github@gmail.com>
ac3a84
Date: Thu, 3 Nov 2022 09:52:23 +0900
ac3a84
Subject: [PATCH] udev: add safe guard for setting by-id symlink
ac3a84
ac3a84
The ID_BUS property is necessary for creating by-id symlinks.
ac3a84
ac3a84
(cherry picked from commit 5286da064c97d2ac934cb301066aaa8605a3c8f9)
ac3a84
ac3a84
Related #2138081
ac3a84
---
ac3a84
 rules.d/60-serial.rules | 1 +
ac3a84
 1 file changed, 1 insertion(+)
ac3a84
ac3a84
diff --git a/rules.d/60-serial.rules b/rules.d/60-serial.rules
ac3a84
index 2c1488e930..a0e66323a9 100644
ac3a84
--- a/rules.d/60-serial.rules
ac3a84
+++ b/rules.d/60-serial.rules
ac3a84
@@ -17,6 +17,7 @@ IMPORT{builtin}="path_id"
ac3a84
 ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="", SYMLINK+="serial/by-path/$env{ID_PATH}"
ac3a84
 ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="?*", SYMLINK+="serial/by-path/$env{ID_PATH}-port$env{.ID_PORT}"
ac3a84
 
ac3a84
+ENV{ID_BUS}=="", GOTO="serial_end"
ac3a84
 ENV{ID_SERIAL}=="", GOTO="serial_end"
ac3a84
 ENV{ID_USB_INTERFACE_NUM}=="", GOTO="serial_end"
ac3a84
 ENV{.ID_PORT}=="", SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_USB_INTERFACE_NUM}"