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.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,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 C39ABC3A5A8 for ; Wed, 4 Sep 2019 18:18:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9CB6C20882 for ; Wed, 4 Sep 2019 18:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567621111; bh=mZkrT94PMPHs9+bKmMZ5XhM9mmWORLtOLRehanlWqzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=O5/YRq8nQ8kPAONF1e6Y5u2vr1nkXNnYm3vMMPUXjVzirn2LEaL6tgCTug8dYu8x3 E8nHtPkZD6f4q9JansWHH22m5Y4PCujiZAjhUDp3yMr2sqs/0qjmyGVJ5LT35JS71+ opv+CddVBQB/VYjZ7Qz3LUFhGP2d3ucVQFTjCxJ4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389876AbfIDSLM (ORCPT ); Wed, 4 Sep 2019 14:11:12 -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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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); }