]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
netfilter: nft_osf: check for TCP packet before further processing
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 10 Jun 2021 18:20:31 +0000 (20:20 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 16 Jun 2021 18:51:50 +0000 (20:51 +0200)
The osf expression only supports for TCP packets, add a upfront sanity
check to skip packet parsing if this is not a TCP packet.

Fixes: b96af92d6eaf ("netfilter: nf_tables: implement Passive OS fingerprint module in nft_osf")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nft_osf.c

index ac61f708b82d23986683130ad2346a148e982d60..d82677e83400b6eb96aa40ac47ec45af06c481ac 100644 (file)
@@ -28,6 +28,11 @@ static void nft_osf_eval(const struct nft_expr *expr, struct nft_regs *regs,
        struct nf_osf_data data;
        struct tcphdr _tcph;
 
+       if (pkt->tprot != IPPROTO_TCP) {
+               regs->verdict.code = NFT_BREAK;
+               return;
+       }
+
        tcp = skb_header_pointer(skb, ip_hdrlen(skb),
                                 sizeof(struct tcphdr), &_tcph);
        if (!tcp) {