mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
netfilter: nft_exthdr: Search chunks in SCTP packets only
[ Upstream commit5acc44f394] Since user space does not generate a payload dependency, plain sctp chunk matches cause searching in non-SCTP packets, too. Avoid this potential mis-interpretation of packet data by checking pkt->tprot. Fixes:133dc203d7("netfilter: nft_exthdr: Support SCTP chunks") Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
152b8ac839
commit
e18216cd0e
@@ -371,6 +371,9 @@ static void nft_exthdr_sctp_eval(const struct nft_expr *expr,
|
|||||||
const struct sctp_chunkhdr *sch;
|
const struct sctp_chunkhdr *sch;
|
||||||
struct sctp_chunkhdr _sch;
|
struct sctp_chunkhdr _sch;
|
||||||
|
|
||||||
|
if (pkt->tprot != IPPROTO_SCTP)
|
||||||
|
goto err;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
sch = skb_header_pointer(pkt->skb, offset, sizeof(_sch), &_sch);
|
sch = skb_header_pointer(pkt->skb, offset, sizeof(_sch), &_sch);
|
||||||
if (!sch || !sch->length)
|
if (!sch || !sch->length)
|
||||||
@@ -391,7 +394,7 @@ static void nft_exthdr_sctp_eval(const struct nft_expr *expr,
|
|||||||
}
|
}
|
||||||
offset += SCTP_PAD4(ntohs(sch->length));
|
offset += SCTP_PAD4(ntohs(sch->length));
|
||||||
} while (offset < pkt->skb->len);
|
} while (offset < pkt->skb->len);
|
||||||
|
err:
|
||||||
if (priv->flags & NFT_EXTHDR_F_PRESENT)
|
if (priv->flags & NFT_EXTHDR_F_PRESENT)
|
||||||
nft_reg_store8(dest, false);
|
nft_reg_store8(dest, false);
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user