]> git.baikalelectronics.ru Git - kernel.git/commit
net: cls_flower: Remove filter from mask before freeing it
authorPetr Machata <petrm@mellanox.com>
Mon, 4 Feb 2019 14:50:38 +0000 (14:50 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 Feb 2019 17:19:14 +0000 (09:19 -0800)
commit88222eca0984e90f99aa6cb7354a42c255c945d4
treebac6808b818e8f8c8c544934f93a52cfde26cfb7
parent43f466ebe19acc2ad08566e514d604ed657dc539
net: cls_flower: Remove filter from mask before freeing it

In fl_change(), when adding a new rule (i.e. fold == NULL), a driver may
reject the new rule, for example due to resource exhaustion. By that
point, the new rule was already assigned a mask, and it was added to
that mask's hash table. The clean-up path that's invoked as a result of
the rejection however neglects to undo the hash table addition, and
proceeds to free the new rule, thus leaving a dangling pointer in the
hash table.

Fix by removing fnew from the mask's hash table before it is freed.

Fixes: 0ca7a5a37da1 ("net/sched: cls_flower: Reject duplicated rules also under skip_sw")
Signed-off-by: Petr Machata <petrm@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_flower.c