net/ipv4: swap flow ports when validating source
authorMiao Wang <shankerwangmiao@gmail.com>
Tue, 22 Jun 2021 04:24:50 +0000 (12:24 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 15:07:15 +0000 (17:07 +0200)
commita7d381c90c4be80433efd6082802ec9118cfca54
tree59a29743b8d6feb464797332519cd4fad7cd6080
parent6380a373f9d134b6a122c7002ed996b5f2bb9128
net/ipv4: swap flow ports when validating source

[ Upstream commit c69f114d09891adfa3e301a35d9e872b8b7b5a50 ]

When doing source address validation, the flowi4 struct used for
fib_lookup should be in the reverse direction to the given skb.
fl4_dport and fl4_sport returned by fib4_rules_early_flow_dissect
should thus be swapped.

Fixes: 5a847a6e1477 ("net/ipv4: Initialize proto and ports in flow struct")
Signed-off-by: Miao Wang <shankerwangmiao@gmail.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/fib_frontend.c