Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp504324pxj; Tue, 18 May 2021 08:10:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvv7AtDpPZyFosnLfShZH2hTs/BjzZGFsHrvKZ+2P1+OHlXzrf9bORB0rHM40RKXim1Y33 X-Received: by 2002:a17:906:1617:: with SMTP id m23mr6762624ejd.352.1621350638134; Tue, 18 May 2021 08:10:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621350638; cv=none; d=google.com; s=arc-20160816; b=PdbRW3DMoPIAbjbpnb2yFPyA2t7JGF7AdQxi0ShrxgdwtPdVVBQ08/R7IMRt1rcdfG ZuCUt/8rt3XtYqIQDnsVj1g3RdM5lsmBNSzo2oNvijS7VwKZOARW4kQkxx+941FI0LTT LX5QGDJGNl9fkrAfcTuW3rEth555clIJoR0zw/tjM83RXpLP2giM31MKvtC5KX+33U2Y +fTBXsMVcHoLF8Kf2UcKwWh8mpnHnnutHYEBMwpVWTRb1RVLfmZqAybf5fA68mCtj40h QUcctfUTzT+OrxB98iHh9cGE8w2rzgtLZgSvOrwwlUS1qjQB111uDuvkNNU8l1xPy4cH I0VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ti9PwEWcAjFjab6idvR+sLQiy9JxZPTKZUTqysqHc0o=; b=dScfxIf7P+8zKYN9k2VEZRsr2vNNzMG82cBXDmf5Ugzs6TJRj/AKDYQ9/O4dvvSujd KhH4WDT+co1o3gIjJsZ1fiqVHfUiojC3rLGiPUwnYZdU9+X2qI4AtfddCbWO9mbXo7Ct OOouGme3t/l5EvIKVjXfpyjebPStfWer/Il6i6xNsIaQsg9SNnLSPC5Of30D+Mnh5XL5 KFhJvdq5wlgh59V33YAtNBZIgPnLb1qSt9wjTXienKFpHxGuaMbC+hZweDimTajsZGo5 0MffNS/lF7mTQ9VPCREjoGPc8/BjZzm14BE+bzvIEryqoG+42IRSGP2Wh1nKpRYj0JQv +glw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pZQLXgNc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f16si19286803edy.382.2021.05.18.08.10.04; Tue, 18 May 2021 08:10:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pZQLXgNc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343673AbhEQPwK (ORCPT + 99 others); Mon, 17 May 2021 11:52:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:37738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343860AbhEQPfA (ORCPT ); Mon, 17 May 2021 11:35:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9235C61CDE; Mon, 17 May 2021 14:39:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262383; bh=ZFAuTJO59UT5twKnCexyk2VzbleOLvEsm/3HKj7R0A8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pZQLXgNcn0cLMXR9Qmn2W74vFDMiqGIt64ltNXrcwbunaajA3UeGnakFB09GOinEb 0xsoW5+rh2b3bxcDz8724bo2Y2nB4KRF6XrP5XjLXF2KXHTUS2ZK/haKiOsV/lQ8Mw FT12CmnZnA4ElIFegZFAROCEyo5vA9Et5uWHfpjo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.10 176/289] netfilter: nfnetlink_osf: Fix a missing skb_header_pointer() NULL check Date: Mon, 17 May 2021 16:01:41 +0200 Message-Id: <20210517140311.039474361@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pablo Neira Ayuso [ Upstream commit 5e024c325406470d1165a09c6feaf8ec897936be ] Do not assume that the tcph->doff field is correct when parsing for TCP options, skb_header_pointer() might fail to fetch these bits. Fixes: 11eeef41d5f6 ("netfilter: passive OS fingerprint xtables match") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nfnetlink_osf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/netfilter/nfnetlink_osf.c b/net/netfilter/nfnetlink_osf.c index 916a3c7f9eaf..79fbf37291f3 100644 --- a/net/netfilter/nfnetlink_osf.c +++ b/net/netfilter/nfnetlink_osf.c @@ -186,6 +186,8 @@ static const struct tcphdr *nf_osf_hdr_ctx_init(struct nf_osf_hdr_ctx *ctx, ctx->optp = skb_header_pointer(skb, ip_hdrlen(skb) + sizeof(struct tcphdr), ctx->optsize, opts); + if (!ctx->optp) + return NULL; } return tcp; -- 2.30.2