linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* udevd: fix termination of rule execution
@ 2008-11-01 16:09 Alan Jenkins
  2008-11-01 16:35 ` Kay Sievers
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Jenkins @ 2008-11-01 16:09 UTC (permalink / raw)
  To: linux-hotplug

LAST_RULE was broken, and I broke TK_END by making it do the same.
It used a "break" which exited the switch statement, but not the loop!

=2953= Invalid read of size 4                                                                               
=2953=    at 0x4081EE: dump_token (udev-rules.c:859)                                                        
=2953=    by 0x40BADB: udev_rules_apply_to_event (udev-rules.c:1849)                                        
=2953=    by 0x403F17: udev_event_execute_rules (udev-event.c:554)                                          
=2953=    by 0x418626: main (test-udev.c:100)                                                               
=2953=  Address 0x55ab1f8 is 0 bytes after a block of size 80 alloc'd                                       
=2953=    at 0x4C23082: realloc (vg_replace_malloc.c:429)                                                   
=2953=    by 0x40B13B: udev_rules_new (udev-rules.c:1670)                                                   
=2953=    by 0x418536: main (test-udev.c:84)                                                                
...

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>

diff --git a/udev/udev-rules.c b/udev/udev-rules.c
index f6cc45b..77029f7 100644
--- a/udev/udev-rules.c
+++ b/udev/udev-rules.c
@@ -2319,7 +2319,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
 			continue;
 		case TK_A_LAST_RULE:
 		case TK_END:
-			break;
+			return 0;
 
 		case TK_M_PARENTS_MAX:
 		case TK_M_MAX:
@@ -2334,9 +2334,8 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
 		/* fast-forward to next rule */
 		idx = rule->rule.next_rule;
 		if (idx = 0)
-			break;
+			return 0;
 		dbg(rules->udev, "forward to rule: %u\n", idx);
 		cur = &rules->tokens[idx];
 	}
-	return 0;
 }



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: udevd: fix termination of rule execution
  2008-11-01 16:09 udevd: fix termination of rule execution Alan Jenkins
@ 2008-11-01 16:35 ` Kay Sievers
  0 siblings, 0 replies; 2+ messages in thread
From: Kay Sievers @ 2008-11-01 16:35 UTC (permalink / raw)
  To: linux-hotplug

On Sat, Nov 1, 2008 at 17:09, Alan Jenkins <alan-jenkins@tuffmail.co.uk> wrote:
> LAST_RULE was broken, and I broke TK_END by making it do the same.
> It used a "break" which exited the switch statement, but not the loop!

Ah, nice. Applied.

Thanks,
Kay

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-01 16:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-01 16:09 udevd: fix termination of rule execution Alan Jenkins
2008-11-01 16:35 ` Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).