netfilter: nf_log: consolidate check for NULL logger in lookup function
Subsystems (2)
Pablo Neira Ayuso
maintainerPATCH 1/2 netfilter: nf_log: consolidate check for NULL logger in lookup function
Consolidate pointer fetch to logger and check for NULL in __find_logger().
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- net/netfilter/nf_log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nf_log.c +2 -2
@@ -31,10 +31,10 @@ static struct nf_logger *__find_logger(int pf, const char *str_logger)int i;for (i =0 ; i <NF_LOG_TYPE_MAX ; i++) { -if (loggers[pf][i] ==NULL ) + log =nft_log_dereference (loggers[pf][i]); +if (!log)continue ; - log =nft_log_dereference (loggers[pf][i]);if (!strncasecmp (str_logger, log->name,strlen (log->name)))return log; }
Signature · 1 line
2.30.2
Pablo Neira Ayuso
maintainerPATCH 2/2 netfilter: nf_log: validate nf_logger_find_get()
Sanitize nf_logger_find_get() input parameters, no caller in the tree passes invalid values.
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- net/netfilter/nf_log.c | 5 +++++ 1 file changed, 5 insertions(+)
net/netfilter/nf_log.c +5 -0
@@ -156,6 +156,11 @@ int nf_logger_find_get(int pf, enum nf_log_type type)struct nf_logger *logger;int ret = -ENOENT ; +if (pf >=ARRAY_SIZE (loggers)) +return -EINVAL ; +if (type >=NF_LOG_TYPE_MAX ) +return -EINVAL ; +if (pf ==NFPROTO_INET ) { ret =nf_logger_find_get (NFPROTO_IPV4 , type);if (ret <0 )
Signature · 1 line
2.30.2