Skip to content

Commit 1bc4e01

Browse files
Liping Zhangummakynes
authored andcommitted
netfilter: nft_log: check the validity of log level
User can specify the log level larger than 7(debug level) via nfnetlink, this is invalid. So in this case, we should report EINVAL to the userspace. Signed-off-by: Liping Zhang <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent c2d9a42 commit 1bc4e01

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

net/netfilter/nft_log.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ static int nft_log_init(const struct nft_ctx *ctx,
7979
} else {
8080
li->u.log.level = LOGLEVEL_WARNING;
8181
}
82+
if (li->u.log.level > LOGLEVEL_DEBUG) {
83+
err = -EINVAL;
84+
goto err1;
85+
}
86+
8287
if (tb[NFTA_LOG_FLAGS] != NULL) {
8388
li->u.log.logflags =
8489
ntohl(nla_get_be32(tb[NFTA_LOG_FLAGS]));

0 commit comments

Comments
 (0)