Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp3672354ima; Mon, 4 Feb 2019 03:11:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IZVFLvIkKvJyIoLVGHn1HSyx2kTmVt9UJT9a9O6A6JfM9uvX7wWJyVA34jDkrsegyZn7GRk X-Received: by 2002:a63:e445:: with SMTP id i5mr12543668pgk.307.1549278718214; Mon, 04 Feb 2019 03:11:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549278718; cv=none; d=google.com; s=arc-20160816; b=QdTZs529PM+yVbP3q8RvrYjvGbw8AJLiMGuf/7oVVdw4I0UpYAGgBIt/tlEaCgTc4N STFwlwyONxeJ+bKGLx1qdzWVpeelEyzG0qS3e9lpREnpvPXDXI9DUI8XSgoEgNSLMyc2 Mfm+nCQ9LJXR66oDKiIEXB6nsHKCn9kT1J/O5sMbunXthcDk2FpVduF+mXeDcXZ2U30I xilyH6U6r+HglvDaOZCDfbP1hTmqnphGd0u6g1sgMag5nmZajm0WozgFuq3acdpqMilh E711lrImu5Z1dmuMvjRXXUcJEPVgen+aH+enFMxbw1WXaSMTo0+84Si670Z8dlHE1x/j GSig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6fxtF8lydIOthg4KQOmAhqxj8bD8XEfC5zvuTxDooAg=; b=CpH3uSWxAnr+Yno22JOb3op6lI5zUWCnIHwRGrRGXIGtYevvFfC6JQSkhFq047TNBv 3aZnhyd4MFyN9iCHh31KxfRZQSX1a5p+Vb4F6o22+d60I055SwvsOi7Yl4Y6X1Yy8GiQ H7FwhEsb5Mxy/qGmg+AnTQVC5n9Yw6tMkojwa6MmTNLDC9P47YMpt90FFs0s49h/rKtX EqIPLms0BuqPQHLD1M/QGj2AQmSPO1iPgPvM56bpICj22DGNdINzUEKGJLy/QJyPe7zu /UItcWwQP07zw13tPtQbWgnjHZCawRPt9EpnrZZh/Yxa67lDfZ3OZgASoFDiARt4sHml Rw3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qHX9cjWc; 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 l36si259370plb.433.2019.02.04.03.11.42; Mon, 04 Feb 2019 03:11:58 -0800 (PST) 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=qHX9cjWc; 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 S1729508AbfBDLKu (ORCPT + 99 others); Mon, 4 Feb 2019 06:10:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:37978 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729891AbfBDKkA (ORCPT ); Mon, 4 Feb 2019 05:40:00 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 799482075B; Mon, 4 Feb 2019 10:39:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549276800; bh=UJOtWLVgBIVz+5jVCSR9fBrV5VV7xlbepVeZIWJ+WsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qHX9cjWc/xVdUJZxzmRKmXjBgXq00LEJYl9aYLmBfzgkD2bHF++/QpaUQyk1RK0xL hSIPq27wDLkI1mmnwb9zwVJP4Tk2AcRo3HuDTP4FN563XYq2GV1CddzMBEU3r7b07D avnBhMjF16SGeoxAdZwEZqe7WJDE7crq4H/LInm4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ross Lagerwall , Pravin B Shelar , "David S. Miller" Subject: [PATCH 4.4 02/65] openvswitch: Avoid OOB read when parsing flow nlattrs Date: Mon, 4 Feb 2019 11:35:55 +0100 Message-Id: <20190204103610.986525908@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190204103610.583715954@linuxfoundation.org> References: <20190204103610.583715954@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ross Lagerwall [ Upstream commit 04a4af334b971814eedf4e4a413343ad3287d9a9 ] For nested and variable attributes, the expected length of an attribute is not known and marked by a negative number. This results in an OOB read when the expected length is later used to check if the attribute is all zeros. Fix this by using the actual length of the attribute rather than the expected length. Signed-off-by: Ross Lagerwall Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/openvswitch/flow_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/openvswitch/flow_netlink.c +++ b/net/openvswitch/flow_netlink.c @@ -409,7 +409,7 @@ static int __parse_flow_nlattrs(const st return -EINVAL; } - if (!nz || !is_all_zero(nla_data(nla), expected_len)) { + if (!nz || !is_all_zero(nla_data(nla), nla_len(nla))) { attrs |= 1 << type; a[type] = nla; }