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.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS 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 603EFC433E1 for ; Sun, 5 Jul 2020 19:10:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 41B6A20739 for ; Sun, 5 Jul 2020 19:10:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=c0d3.blue header.i=@c0d3.blue header.b="PjLgNG9U" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727942AbgGETKY (ORCPT ); Sun, 5 Jul 2020 15:10:24 -0400 Received: from mail.aperture-lab.de ([138.201.29.205]:45074 "EHLO mail.aperture-lab.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727823AbgGETKX (ORCPT ); Sun, 5 Jul 2020 15:10:23 -0400 From: =?UTF-8?q?Linus=20L=C3=BCssing?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c0d3.blue; s=2018; t=1593976221; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bmg9uf6mYHkfh9utTYp2Nm+8c0oAt214toZIvaTa5jo=; b=PjLgNG9UZv+o/MTuf6PQhE/l0t88wYz61/qnGGPnCH4zPpWgk073ZxSkEBvjwiQVCsVMHO kd/NchNe1VK6ltz5xIgSRox0igKlcUsYpfWF7L5gEo1IVS2gWV3uYz4VlP4KrYZsEGh5qF FJ/Lhto/t+RSZmrneXJwYl3yeS26iDjswGtydlJHr0D1yvPJDw4rx0YFhaWZTbDqydIBII OVNFgYPNWSdH3abLjGoxJsccIMI3hm/atv/jVrmVNq2/Dfo0++/lq28tVbDTo6S4laZi6I TZirZcyo857w8BvLLCr7oh7XRl4qmjJfGgZdvAjDPI1f+ilnGgcPhZ/0YVrpPg== To: netdev@vger.kernel.org Cc: Roopa Prabhu , Nikolay Aleksandrov , Martin Weinelt , "David S . Miller" , bridge@lists.linux-foundation.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Linus=20L=C3=BCssing?= Subject: [PATCH net v2] bridge: mcast: Fix MLD2 Report IPv6 payload length check Date: Sun, 5 Jul 2020 21:10:17 +0200 Message-Id: <20200705191017.10546-1-linus.luessing@c0d3.blue> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Authentication-Results: ORIGINATING; auth=pass smtp.auth=linus.luessing@c0d3.blue smtp.mailfrom=linus.luessing@c0d3.blue Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Commit e57f61858b7c ("net: bridge: mcast: fix stale nsrcs pointer in igmp3/mld2 report handling") introduced a bug in the IPv6 header payload length check which would potentially lead to rejecting a valid MLD2 Report: The check needs to take into account the 2 bytes for the "Number of Sources" field in the "Multicast Address Record" before reading it. And not the size of a pointer to this field. Fixes: e57f61858b7c ("net: bridge: mcast: fix stale nsrcs pointer in igmp3/mld2 report handling") Acked-by: Nikolay Aleksandrov Signed-off-by: Linus Lüssing --- Changelog v2: * updated commit message, the issue is accidentally rejcting a valid and not accepting an invalid MLD2 Report net/bridge/br_multicast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 83490bf73a13..4c4a93abde68 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -1000,21 +1000,21 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, num = ntohs(icmp6h->icmp6_dataun.un_data16[1]); len = skb_transport_offset(skb) + sizeof(*icmp6h); for (i = 0; i < num; i++) { __be16 *_nsrcs, __nsrcs; u16 nsrcs; nsrcs_offset = len + offsetof(struct mld2_grec, grec_nsrcs); if (skb_transport_offset(skb) + ipv6_transport_len(skb) < - nsrcs_offset + sizeof(_nsrcs)) + nsrcs_offset + sizeof(__nsrcs)) return -EINVAL; _nsrcs = skb_header_pointer(skb, nsrcs_offset, sizeof(__nsrcs), &__nsrcs); if (!_nsrcs) return -EINVAL; nsrcs = ntohs(*_nsrcs); grec_len = struct_size(grec, grec_src, nsrcs); -- 2.27.0