瀏覽代碼

netfilter: nft_osf: check if attribute is present

If the attribute is not sent, eg. old libnftnl binary, then
tb[NFTA_OSF_TTL] is NULL and kernel crashes from the _init path.

Fixes: a218dc82f0b5 ("netfilter: nft_osf: Add ttl option support")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso 6 年之前
父節點
當前提交
5e91c9d9cd
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      net/netfilter/nft_osf.c

+ 1 - 1
net/netfilter/nft_osf.c

@@ -50,7 +50,7 @@ static int nft_osf_init(const struct nft_ctx *ctx,
 	int err;
 	int err;
 	u8 ttl;
 	u8 ttl;
 
 
-	if (nla_get_u8(tb[NFTA_OSF_TTL])) {
+	if (tb[NFTA_OSF_TTL]) {
 		ttl = nla_get_u8(tb[NFTA_OSF_TTL]);
 		ttl = nla_get_u8(tb[NFTA_OSF_TTL]);
 		if (ttl > 2)
 		if (ttl > 2)
 			return -EINVAL;
 			return -EINVAL;