Skip to content

Commit

Permalink
tc: Fix using uninitialized id chain.
Browse files Browse the repository at this point in the history
tc_make_tcf_id() doesn't initialize the 'chain' field leaving it with a
random value from the stack.  This makes request_from_tcf_id() create
request with random TCA_CHAIN included.  These requests are obviously
doesn't work as needed leading to broken flow dump and various other
issues.  Fix that by using designated initializer instead.

Fixes: acdd544 ("tc: Introduce tcf_id to specify a tc filter")
Signed-off-by: Ilya Maximets <[email protected]>
Acked-by: Roi Dayan <[email protected]>
Signed-off-by: Simon Horman <[email protected]>
  • Loading branch information
igsilya authored and shorman-netronome committed Jan 7, 2020
1 parent aeee334 commit e64fe4e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/tc.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,12 @@ static inline struct tcf_id
tc_make_tcf_id(int ifindex, uint32_t block_id, uint16_t prio,
enum tc_qdisc_hook hook)
{
struct tcf_id id;

id.block_id = block_id;
id.ifindex = ifindex;
id.prio = prio;
id.hook = hook;
id.handle = 0;
struct tcf_id id = {
.hook = hook,
.block_id = block_id,
.ifindex = ifindex,
.prio = prio,
};

return id;
}
Expand Down

0 comments on commit e64fe4e

Please sign in to comment.