Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3082114pxj; Mon, 17 May 2021 17:18:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQHkZDdyEIveKIA2wqgrBISikypFmGHFMv4BD1x93bP7uCP2xIK67YD4YjiAmy8rg5F4tL X-Received: by 2002:a05:6402:2206:: with SMTP id cq6mr3411022edb.73.1621297120854; Mon, 17 May 2021 17:18:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621297120; cv=none; d=google.com; s=arc-20160816; b=x/MXHHS5SPfEvsDdmY8ukPgEYvVnpzW/SywuXzMpR7nY9gfWu6sMGygansEiyX7g/D x2VPC2UPtpInmVPBTFt9RJ03fsSeS3X8HQ58ixk4nKreyhpeE32CnY82Za6R92PV6tN/ APVfG5AHrpGrP5iVJgHPdkXgsEGDhQXwSQEBoynEBw3a102tScl6lhlmaYggBa9NKexd CJcLh4nO8cxtclAFyc+qgC7YnphXp9P6VYg8qzAXt1DF/5qTC/LDGFUaPuMGyRCwcrMH 0KmH/fvaku6QieSjhWreb5FDjjYO6O8DGLFes/sY1lLbD2D4Lqdkr41hJrATRTmMTi2S WK5A== 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=gvQ80pWzos4M8KK2jdsMG9z6RZaphpsiYevxmVZjJZnA/rxjEPXFkN+EWB6O7cFHkd L5dGKb9yY21MAezBAYX3lM7J02gSHUhTxlD1ZIp+E10V5nIijha5DAmwRAzVjyYfjjxD zxCGgg5C4nSFYiVCaVdObqEuBm6T0f2jABvUSTeydkr4m64JTyREyhlXYXP2XrKsGL0s 0S1OyATHdxN0LER7QjyyR/7DHEXBYabmoH5TWaUo0yFWNC8VSxhOUwDan4xLSf6Cp8UI XqMk7E4cdECO1lwm/Hki5Iw5pw1VX2ZyrtlQxkhQKf7Sz9cOyOJLaEMBAyZGbkNHyLin e1Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lOtDTDty; 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 i18si14869023ejy.385.2021.05.17.17.18.17; Mon, 17 May 2021 17:18:40 -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=lOtDTDty; 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 S238451AbhEQO2T (ORCPT + 99 others); Mon, 17 May 2021 10:28:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:53200 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239455AbhEQOYL (ORCPT ); Mon, 17 May 2021 10:24:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3B0E861476; Mon, 17 May 2021 14:12:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260758; bh=ZFAuTJO59UT5twKnCexyk2VzbleOLvEsm/3HKj7R0A8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lOtDTDtygo35ITjIwS20JHU1ZJ6PlCSx/BJV2gjiIEQbB7hGKqmRu9Z2VcnMbqptM bjm8dcDC1w7W6K77cL/ZjpitKD3gGRzM54rit2Sct68lQ6Li+s7rBuryw+iiH5QkKs N57G+xzzFTZkm5kGHyhqKyp8rYEJDf9kKkKIJqVs= 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.12 228/363] netfilter: nfnetlink_osf: Fix a missing skb_header_pointer() NULL check Date: Mon, 17 May 2021 16:01:34 +0200 Message-Id: <20210517140310.294199173@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@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