Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1025688ybe; Wed, 4 Sep 2019 11:20:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxA2yPVn0yknt+k+ez+1QZKG3Qs0RLN0wOjzCkj+k38H0sRSmWpxVsCtyjjl+5EsvD/Xz/ X-Received: by 2002:a17:90a:33e7:: with SMTP id n94mr6608687pjb.15.1567621213913; Wed, 04 Sep 2019 11:20:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567621213; cv=none; d=google.com; s=arc-20160816; b=qIGQ65TJ55I6SkHd+Cu0kPp+lgqfG0+dmQq3EgDlUeBOW01CdNIc5iuINPZ0e9cknD Ne70C86qWRLFIQfvOFKFE/w9GgZw5LQzRIras9lZE1NZaq/ZVjHWbR1DXgi47Dn7qFaD HUcTl6lLAPf/Hy0teGkZWfW0cFmMWr51emE9VlfSdGLHqVSbc1xYGsCLFKpTTyNylo8U JeKPUA5JMoP6na6TFUzAnLViXothCSzxWvE+kUl1wJYZnupMUiUyEltlldGG8U2HBZ/5 KR9U3pUGKAAvwB7Q98En0OyJSbawHI5nTDkFhFDDKwHzpTsxDLg2ytFndgxK1qOpzB6+ kmJA== 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=ZuM37Cb4JqQptSiUE1MI3UEIuwkB2wHn7w9AmTrQor4=; b=Dycx69jwsISHfNpFJkWrCljmIg2yELiPK9cBRB4c7O8RiIeY9J4RdF1KrK1uhNwlWR dc6uP595sXJYxj51/VevNfTyoBR/+I4OL3gGVs3PbYmwVQoB3tWLA5YVAMhq1YaP45Mo oBJIWtxMr58z9dphFQPOJCFOYIEJ3RgDMEskt96QEqysYQ/W/Q8Yhmq6sohvS12Kc6c9 zCGbit2kPfjBPWjeDuFIKepOTksjgHj/wZdyVyW/tHTpwb7EBlI0UaXbrq5AvMDqry4i 6XzEXFT/cDp76ndlhOLNtw7r/uKPA55JV+C8gGPy9bDWFf61Gd9vwYSF/TVcTm3cFwHH 37ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pygq+Kcy; 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 k9si16393725pfp.155.2019.09.04.11.19.57; Wed, 04 Sep 2019 11:20:13 -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=pygq+Kcy; 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 S2390243AbfIDSLO (ORCPT + 99 others); Wed, 4 Sep 2019 14:11:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:55098 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389078AbfIDSLL (ORCPT ); Wed, 4 Sep 2019 14:11:11 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 EB951206BA; Wed, 4 Sep 2019 18:11:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620670; bh=mZkrT94PMPHs9+bKmMZ5XhM9mmWORLtOLRehanlWqzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pygq+KcyTLdQgVMNRWJb8MwZb0lY7pCEqln7rniMQzZCmWCvVWPi/vPdqONyNK0Y+ Um1eMNd23zlkXopR95ssbEe47tdGoRNmjS7FM2Yl0RImzodlA2EWAkxm+RsiibVWwj hYTBmfsm8+UoAhEIzJDOm0gdtjItokXzYrHsD2JU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefano Brivio , Guillaume Nault , "David S. Miller" Subject: [PATCH 5.2 050/143] ipv6: Fix return value of ipv6_mc_may_pull() for malformed packets Date: Wed, 4 Sep 2019 19:53:13 +0200 Message-Id: <20190904175316.027989092@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175314.206239922@linuxfoundation.org> References: <20190904175314.206239922@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Stefano Brivio Commit ba5ea614622d ("bridge: simplify ip_mc_check_igmp() and ipv6_mc_check_mld() calls") replaces direct calls to pskb_may_pull() in br_ipv6_multicast_mld2_report() with calls to ipv6_mc_may_pull(), that returns -EINVAL on buffers too short to be valid IPv6 packets, while maintaining the previous handling of the return code. This leads to the direct opposite of the intended effect: if the packet is malformed, -EINVAL evaluates as true, and we'll happily proceed with the processing. Return 0 if the packet is too short, in the same way as this was fixed for IPv4 by commit 083b78a9ed64 ("ip: fix ip_mc_may_pull() return value"). I don't have a reproducer for this, unlike the one referred to by the IPv4 commit, but this is clearly broken. Fixes: ba5ea614622d ("bridge: simplify ip_mc_check_igmp() and ipv6_mc_check_mld() calls") Signed-off-by: Stefano Brivio Acked-by: Guillaume Nault Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/net/addrconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -206,7 +206,7 @@ static inline int ipv6_mc_may_pull(struc unsigned int len) { if (skb_transport_offset(skb) + ipv6_transport_len(skb) < len) - return -EINVAL; + return 0; return pskb_may_pull(skb, len); }