Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3952636imm; Sun, 13 May 2018 23:51:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpMyKokBQVG18X2bw5TO9/vrhtYsji99VxPZE8wp2g4wLmTdgHwIkXtBzDGhG/3gfHNgwjq X-Received: by 2002:a63:7b10:: with SMTP id w16-v6mr7679020pgc.355.1526280665572; Sun, 13 May 2018 23:51:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526280665; cv=none; d=google.com; s=arc-20160816; b=hxYiZzI0fMu0eegaQ+KRF5XG0+x28ci3ymG2VNhcNUAGoG4Kvop+SjJJcf0xVIoNjP bo8I+S2Q9l3YFArHiWsg8IeOxc/cGjPRCd0Dn6IKHWZdfmD/aQZfAR0Ov+FQJzOVuo0r KvJbtjKPT1EtmuoE6Y7JhjdEzuAmY00t4y+qUzT6CRn1xQy3Zy/7Dxo0Hcung/zAxP48 9Ib2KTk7zIskohcmoL6RwXtBDuVM+zqhiACRzYO4mQio7vbarENvsp1N07ac+F13buHh oo4RhcPEJOn9GL3RrjqkNG5g+toXFk+9M7kbp8wv+G+4YHPgUWuPvXcdCwIiKttk4euR rWtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=GvobVdLpZrcoPi/79W8qTbDQj0y7z8/kOd+qYm75ij0=; b=ThHTw/BhrKGr+JCtC7VEqUy7GrJRun3Pc5DsPnr2sSC6U1mOp1HgoJE+RekdDgg7RO JLfYDzyx7o4oFHDe4YAg2uqOKOuGa1bzje8SOVaFN8qKLHTUEOvtoxT6gW9zfz2KNwzY aUxPUyOQrt7e4X3o5pYH/dSubF1KFsnlGRPVOXvGogkQzQDjB9T++2y9TMpDqPsywJ2I pLV+S3aUtZOcz9jkXk0el3M0+tTvugrYCB2iW+voopMoV4d1TD00IV5n4s/V0N9/xZSO U2GKvngZLY4SGDGieyzGylE5WOULNrQz5Wv6wPbzV0TXp4xvDqnSqBVR+QbjG69tlp9Q tYNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gEnFZlnf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t5-v6si7163542pgu.341.2018.05.13.23.50.50; Sun, 13 May 2018 23:51:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gEnFZlnf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752260AbeENGuh (ORCPT + 99 others); Mon, 14 May 2018 02:50:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:57324 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752243AbeENGue (ORCPT ); Mon, 14 May 2018 02:50:34 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3EF7F21748; Mon, 14 May 2018 06:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1526280633; bh=2fjOfgvRe1b2EwskIfpd+b42xhH8ArOZydyRoAmgd3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gEnFZlnfUyTCmfvvQwdY/tVWjmP2w0iiC5uTpAX6YU8VT+ADNocu9DerEpm1SGghj dVMax9N9KG0+9Z8YEf90o79xpYLqpKbatwjz7h3MBEPsBpdqWFm9Mco2TebreigqA8 dl84oeJ6J4Om1vZA690IxuNZ8mQIms+XkDpibXhE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , syzbot , "David S. Miller" Subject: [PATCH 3.18 13/23] net: fix rtnh_ok() Date: Mon, 14 May 2018 08:48:42 +0200 Message-Id: <20180514064704.622427901@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180514064704.046463679@linuxfoundation.org> References: <20180514064704.046463679@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet commit b1993a2de12c9e75c35729e2ffbc3a92d50c0d31 upstream. syzbot reported : BUG: KMSAN: uninit-value in rtnh_ok include/net/nexthop.h:11 [inline] BUG: KMSAN: uninit-value in fib_count_nexthops net/ipv4/fib_semantics.c:469 [inline] BUG: KMSAN: uninit-value in fib_create_info+0x554/0x8d20 net/ipv4/fib_semantics.c:1091 @remaining is an integer, coming from user space. If it is negative we want rtnh_ok() to return false. Fixes: 4e902c57417c ("[IPv4]: FIB configuration using struct fib_config") Signed-off-by: Eric Dumazet Reported-by: syzbot Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/net/nexthop.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/net/nexthop.h +++ b/include/net/nexthop.h @@ -6,7 +6,7 @@ static inline int rtnh_ok(const struct rtnexthop *rtnh, int remaining) { - return remaining >= sizeof(*rtnh) && + return remaining >= (int)sizeof(*rtnh) && rtnh->rtnh_len >= sizeof(*rtnh) && rtnh->rtnh_len <= remaining; }