From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roopa Prabhu Subject: Re: [PATCH net-next v3 1/3] ipv4: support sport, dport and ip_proto in RTM_GETROUTE Date: Wed, 16 May 2018 13:30:28 -0700 Message-ID: References: <1526442908-13183-1-git-send-email-roopa@cumulusnetworks.com> <1526442908-13183-2-git-send-email-roopa@cumulusnetworks.com> <20180516.143714.1321600980314123555.davem@davemloft.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: netdev , David Ahern , Nikolay Aleksandrov , Ido Schimmel To: David Miller Return-path: Received: from mail-ua0-f196.google.com ([209.85.217.196]:47082 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751013AbeEPUa3 (ORCPT ); Wed, 16 May 2018 16:30:29 -0400 Received: by mail-ua0-f196.google.com with SMTP id e8-v6so1421391uam.13 for ; Wed, 16 May 2018 13:30:29 -0700 (PDT) In-Reply-To: <20180516.143714.1321600980314123555.davem@davemloft.net> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, May 16, 2018 at 11:37 AM, David Miller wrote: > From: Roopa Prabhu > Date: Tue, 15 May 2018 20:55:06 -0700 > >> +static int inet_rtm_getroute_reply(struct sk_buff *in_skb, struct nlmsghdr *nlh, >> + __be32 dst, __be32 src, struct flowi4 *fl4, >> + struct rtable *rt, struct fib_result *res) >> +{ >> + struct net *net = sock_net(in_skb->sk); >> + struct rtmsg *rtm = nlmsg_data(nlh); >> + u32 table_id = RT_TABLE_MAIN; >> + struct sk_buff *skb; >> + int err = 0; >> + >> + skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); >> + if (!skb) >> + return -ENOMEM; > > If the caller can use GFP_KERNEL, so can this allocation. yes, but we hold rcu read lock before calling the reply function for fib result. I did consider allocating the skb before the read lock..but then the refactoring (into a separate netlink reply func) would seem unnecessary. I am fine with pre-allocating and undoing the refactoring if that works better.