ipv4: Fix crashes in fib_rules_tclass().

This change “ipv4: Fix crashes in fib_rules_tclass().” (commit e044a65) in Linux kernel is authored by David S. Miller <davem [at] davemloft.net> on Tue Jul 10 18:05:28 2012 -0700.

Description of "ipv4: Fix crashes in fib_rules_tclass()."

The change “ipv4: Fix crashes in fib_rules_tclass().” introduces changes as follows.

ipv4: Fix crashes in fib_rules_tclass().

All paths assume, when CONFIG_IP_MULTIPLE_TABLES is enabled, that any
successful call to fib_lookup() will initialize the fib_result->r
value to something.

We violated that expectation in the new fib_lookup() fast path.

Reported-by: Or Gerlitz <ogerlitz@mellanox.com>
Tested-by: Eric Dumazet <eric.dumazet@gmail.com>
Tested-by: Greg Rose <gregory.v.rose@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Linux kernel releases containing commit e044a65

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "ipv4: Fix crashes in fib_rules_tclass()."

There is one line of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 include/net/ip_fib.h | 1 +
 1 file changed, 1 insertion(+)
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 539c6721f810..000c4674e18e 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -230,6 +230,7 @@ static inline int fib_lookup(struct net *net, struct flowi4 *flp,
 			     struct fib_result *res)
 	if (!net->ipv4.fib_has_custom_rules) {
+		res->r = NULL;
 		if (net->ipv4.fib_local &&
 		    !fib_table_lookup(net->ipv4.fib_local, flp, res,

The commit for this change in Linux stable tree is e044a65 (patch).

Last modified: 2020/02/10