From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A11FFC282C7 for ; Tue, 29 Jan 2019 12:10:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 65A802147A for ; Tue, 29 Jan 2019 12:10:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548763805; bh=Xflo/7J5sxtNrHU+CFbpSb/wkyUBAsgMlUc6eFEQ38w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=1S1TT6fWVs59GOY8zY0YszSOKMn/Uw4WBrHtllNLTu50wGbRIhEtJhOXxkeF+13Tm Q4xZrMCN56gJc7ao8SxAQddxbRcoBulYHMlp3EpajEtJgTGaTpfL0D+7a1gIxTBoL/ qhLdWdwKzLPnsnvE44ayj1KhrNLhiLZz7JEVJB14= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728968AbfA2Lh6 (ORCPT ); Tue, 29 Jan 2019 06:37:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:54598 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728983AbfA2Lh6 (ORCPT ); Tue, 29 Jan 2019 06:37:58 -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 2608A20844; Tue, 29 Jan 2019 11:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548761877; bh=Xflo/7J5sxtNrHU+CFbpSb/wkyUBAsgMlUc6eFEQ38w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wLMVkAM+q77GWs/T4KqKxtPDKdXDJ5Ula1mRtRr9CuIpFUhMnatdQTMs1OAwx6Iae o5m3z2mX2T1B81IFVk27dZj+eO+ze3iWYi65so2Ys02/tqNEf7CjDWrHZb7kvGjQgw W++qH5eO74020yH5pAQOPHinQAbqdOVTTxlpo4F0= 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.20 009/117] openvswitch: Avoid OOB read when parsing flow nlattrs Date: Tue, 29 Jan 2019 12:34:20 +0100 Message-Id: <20190129113207.992571984@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190129113207.477505932@linuxfoundation.org> References: <20190129113207.477505932@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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 4.20-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 @@ -500,7 +500,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; }