From: Roopa Prabhu <roopa@cumulusnetworks.com>
To: David Miller <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>,
David Ahern <dsa@cumulusnetworks.com>,
Nikolay Aleksandrov <nikolay@cumulusnetworks.com>,
Ido Schimmel <idosch@mellanox.com>
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 [thread overview]
Message-ID: <CAJieiUi1p31mrRRP2=X-Z-8fWyfea2JVMgmponMwrUzQF-OyoA@mail.gmail.com> (raw)
In-Reply-To: <20180516.143714.1321600980314123555.davem@davemloft.net>
On Wed, May 16, 2018 at 11:37 AM, David Miller <davem@davemloft.net> wrote:
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
> 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.
next prev parent reply other threads:[~2018-05-16 20:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-16 3:55 [PATCH net-next v3 0/3] fib rule selftest Roopa Prabhu
2018-05-16 3:55 ` [PATCH net-next v3 1/3] ipv4: support sport, dport and ip_proto in RTM_GETROUTE Roopa Prabhu
2018-05-16 18:37 ` David Miller
2018-05-16 20:30 ` Roopa Prabhu [this message]
2018-05-17 2:36 ` David Miller
2018-05-17 13:58 ` Roopa Prabhu
2018-05-16 3:55 ` [PATCH net-next v3 2/3] ipv6: " Roopa Prabhu
2018-05-16 3:55 ` [PATCH net-next v3 3/3] selftests: net: initial fib rule tests Roopa Prabhu
2018-05-22 5:15 ` [lkp-robot] [selftests] 3f45449746: kernel_selftests.net.fib_rule_tests.sh.fail kernel test robot
2018-05-22 16:01 ` Roopa Prabhu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJieiUi1p31mrRRP2=X-Z-8fWyfea2JVMgmponMwrUzQF-OyoA@mail.gmail.com' \
--to=roopa@cumulusnetworks.com \
--cc=davem@davemloft.net \
--cc=dsa@cumulusnetworks.com \
--cc=idosch@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=nikolay@cumulusnetworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).