summaryrefslogtreecommitdiff
path: root/udev
diff options
context:
space:
mode:
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>2008-11-01 17:32:16 +0100
committerKay Sievers <kay.sievers@vrfy.org>2008-11-01 17:32:16 +0100
commitd15fcce4b3e90a27eb911bd954efd07219c1c9db (patch)
tree336bf613c116de88d917e17cfe731b4886f4be03 /udev
parent11ae7578505caa8df5604c6c86c82e9558439b30 (diff)
udevd: be more careful when matching against parents
I'm worried about what will happen with things like KERNELS=="*" # pointless rule KERNELS=="doesnt-match" # another pointless rule Since TK_RULE < TK_M_PARENTS_MAX, we will try to match all three tokens against parents of the current device. I can't think of a bad case, but it's not exactly good either. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Diffstat (limited to 'udev')
-rw-r--r--udev/udev-rules.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/udev/udev-rules.c b/udev/udev-rules.c
index 77029f7bec..e1307252d8 100644
--- a/udev/udev-rules.c
+++ b/udev/udev-rules.c
@@ -93,6 +93,7 @@ enum token_type {
TK_M_WAITFOR, /* val */
TK_M_ATTR, /* val, attr */
+ TK_M_PARENTS_MIN,
TK_M_KERNELS, /* val */
TK_M_SUBSYSTEMS, /* val */
TK_M_DRIVERS, /* val */
@@ -146,6 +147,7 @@ static const char *token_str[] = {
[TK_M_WAITFOR] = "M WAITFOR",
[TK_M_ATTR] = "M ATTR",
+ [TK_M_PARENTS_MIN] = "M PARENTS_MIN",
[TK_M_KERNELS] = "M KERNELS",
[TK_M_SUBSYSTEMS] = "M SUBSYSTEMS",
[TK_M_DRIVERS] = "M DRIVERS",
@@ -806,6 +808,7 @@ static int rule_add_token(struct rule_tmp *rule_tmp, enum token_type type,
token->key.event_timeout = *(int *)data;
break;
case TK_RULE:
+ case TK_M_PARENTS_MIN:
case TK_M_PARENTS_MAX:
case TK_M_MAX:
case TK_END:
@@ -943,6 +946,7 @@ static void dump_token(struct udev_rules *rules, struct token *token)
case TK_END:
dbg(rules->udev, "* %s\n", token_str[type]);
break;
+ case TK_M_PARENTS_MIN:
case TK_M_PARENTS_MAX:
case TK_M_MAX:
case TK_UNSET:
@@ -1937,7 +1941,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
/* get whole sequence of parent matches */
next = cur;
- while (next->type < TK_M_PARENTS_MAX)
+ while (next->type > TK_M_PARENTS_MIN && next->type < TK_M_PARENTS_MAX)
next++;
/* loop over parents */
@@ -2321,6 +2325,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
case TK_END:
return 0;
+ case TK_M_PARENTS_MIN:
case TK_M_PARENTS_MAX:
case TK_M_MAX:
case TK_UNSET: