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=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham 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 B24AFC43219 for ; Fri, 26 Apr 2019 17:08:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 85944208CA for ; Fri, 26 Apr 2019 17:08:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726193AbfDZRID (ORCPT ); Fri, 26 Apr 2019 13:08:03 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:38070 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726068AbfDZRID (ORCPT ); Fri, 26 Apr 2019 13:08:03 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1hK4KP-000571-TU; Fri, 26 Apr 2019 19:08:01 +0200 Message-ID: Subject: Re: [RFC] netlink: limit recursion depth in policy validation From: Johannes Berg To: Pablo Neira Ayuso Cc: netdev@vger.kernel.org Date: Fri, 26 Apr 2019 19:08:00 +0200 In-Reply-To: <20190426170649.5aa6b64464zmeeze@salvia> References: <20190405212414.24184-1-johannes@sipsolutions.net> <20190426165710.o4dpxzq5futnspu7@salvia> <7be848796a1f5552e611e131c8613408c128bfc8.camel@sipsolutions.net> <20190426170649.5aa6b64464zmeeze@salvia> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-2.fc28) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, 2019-04-26 at 19:06 +0200, Pablo Neira Ayuso wrote: > > > This basically flattens the whole thing. > > > > Obviously, the walking may allocate some memory, and the last loop to > > send it out isn't actually a loop like that because it's a netlink dump > > with each entry being in a separate netlink message, but that's the gist > > of it. > > I see, following this approach, I can just remove the duplicated code > in my netlink description stuff by using the list of policy > structures. I wrote the code in a way that you can reuse it easily, check out the patch :-) Generic netlink is one user added by the patch, but the actual exposing code is with general attributes and general code that you can easily call. Meanwhile, I'm still writing a response to your other email, give me a few minutes. johannes