Message ID | 20200310123615.720352829@linuxfoundation.org |
---|---|
State | Superseded |
Headers | show
Return-Path: <SRS0=QSPG=43=vger.kernel.org=stable-owner@kernel.org> 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,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 F13FDC18E5A for <stable@archiver.kernel.org>; Tue, 10 Mar 2020 13:34:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C3AB32467D for <stable@archiver.kernel.org>; Tue, 10 Mar 2020 13:34:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583847240; bh=lH07DyGfCpn7Umrw/EPCa6h0VuEhaCMiaDb8h6et0cI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=1mZV8QKNtD1Ql7Y1Bq2tB/LWHc7i9UzG3002LAiunFmaiOGDT5IUWf1Mx6/vcQP3o S8HRdAVjhY1q8GqhhdX3JL04St8B9/GJOzsSgJzMes3ccytkVcR9820MH1pHYMXaKW tSk8bYpiBfsK8CAeNtZSenEOWXRihsOPSH+WiwY4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727766AbgCJMrK (ORCPT <rfc822;stable@archiver.kernel.org>); Tue, 10 Mar 2020 08:47:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:50822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728112AbgCJMrJ (ORCPT <rfc822;stable@vger.kernel.org>); Tue, 10 Mar 2020 08:47:09 -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 D732624696; Tue, 10 Mar 2020 12:47:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583844429; bh=lH07DyGfCpn7Umrw/EPCa6h0VuEhaCMiaDb8h6et0cI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h2HpeYtoevXOSWDEUziZLGetMCSIbUfsJjWmjxb51FEHXYwctH4IxeQ9CjJDwO1W/ DKdbKd/emQEsjik4yn43fIwU3Hg95GhQKZWog9satYQgZc3SGoYjiOzgQS2ZumItha Y0QkrjednCgXW1Htnv4R35PfncLXj0p3aCQVsPlI= From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org, Christophe Leroy <christophe.leroy@c-s.fr>, Richard Guy Briggs <rgb@redhat.com>, "Erhard F." <erhard_f@mailbox.org>, Nikolay Aleksandrov <nikolay@cumulusnetworks.com>, "David S. Miller" <davem@davemloft.net> Subject: [PATCH 4.9 40/88] net: netlink: cap max groups which will be considered in netlink_bind() Date: Tue, 10 Mar 2020 13:38:48 +0100 Message-Id: <20200310123615.720352829@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200310123606.543939933@linuxfoundation.org> References: <20200310123606.543939933@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: <stable.vger.kernel.org> X-Mailing-List: stable@vger.kernel.org |
Series |
None
|
expand
|
--- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -1003,7 +1003,8 @@ static int netlink_bind(struct socket *s if (nlk->netlink_bind && groups) { int group; - for (group = 0; group < nlk->ngroups; group++) { + /* nl_groups is a u32, so cap the maximum groups we can bind */ + for (group = 0; group < BITS_PER_TYPE(u32); group++) { if (!test_bit(group, &groups)) continue; err = nlk->netlink_bind(net, group + 1); @@ -1022,7 +1023,7 @@ static int netlink_bind(struct socket *s netlink_insert(sk, nladdr->nl_pid) : netlink_autobind(sock); if (err) { - netlink_undo_bind(nlk->ngroups, groups, sk); + netlink_undo_bind(BITS_PER_TYPE(u32), groups, sk); return err; } }