match: don't fail on invalid item types
authorDaniel Mack <daniel@zonque.org>
Wed, 10 Sep 2014 16:03:52 +0000 (18:03 +0200)
committerDaniel Mack <daniel@zonque.org>
Wed, 10 Sep 2014 16:04:02 +0000 (18:04 +0200)
match.c

diff --git a/match.c b/match.c
index be25038d9954fcb6bfae5a1df917f165cf070be0..48b86ca1ceb0a65d44b31357a0041dd7aefa05d8 100644 (file)
--- a/match.c
+++ b/match.c
@@ -374,8 +374,6 @@ int kdbus_match_db_add(struct kdbus_conn *conn,
                        break;
                }
 
-               rule->type = item->type;
-
                switch (item->type) {
                case KDBUS_ITEM_BLOOM_MASK: {
                        u64 generations;
@@ -458,13 +456,15 @@ int kdbus_match_db_add(struct kdbus_conn *conn,
                        break;
 
                default:
-                       ret = -EINVAL;
-                       break;
+                       kfree(rule);
+                       continue;
                }
 
                if (ret < 0)
                        break;
 
+               rule->type = item->type;
+
                list_add_tail(&rule->rules_entry, &entry->rules_list);
        }