netlink: Add allocation flag to netlink_unicast()
Subsystems (27)
cover netlink: Add allocation flag to netlink_unicast()
Though netlink_broadcast() has allocation flag which can specify memory allocation type (ex. GFP_KERNEL/GFP_ATOMIC), netlink_unicast() does not have it. This can cause "BUG: sleeping function called from invalid context at" with CONFIG_DEBUG_ATOMIC_SLEEP enabled kernel when calling netlink_unicast() inside RCU read-side section and not in IRQ.
Though currently such a use case was not found, to solve potential issue we will add an allocation flag to netlink_unicast(). Previously netlink_unicast() have used gfp_any() as a flag. We replaced it to GFP_KERNEL or GFP_ATOMIC or etc by guessing based on context. If we could not determine the value, we remain it gfp_any(). We welcome comments like "this gfp_any() should be GFP_KERNEL". Of course other comments are welcome as well.
This series of patches are not tested.
This is a RFC because this does not fix existing issue.
Masashi Honma (7):
netlink: Add allocation flag to netlink_unicast()
netfilter: Add allocation flag to nfnetlink_unicast()
netlink: Add allocation flag to nlmsg_unicast()
infiniband: Add allocation flag to ibnl_unicast()
net: Add allocation flag to rtnl_unicast()
genetlink: Add allocation flag to genlmsg_unicast()
genetlink: Add allocation flag to genlmsg_reply()
crypto/crypto_user.c | 3 ++- drivers/block/drbd/drbd_nl.c | 2 +- drivers/connector/connector.c | 2 +- drivers/infiniband/core/iwpm_msg.c | 6 ++--- drivers/infiniband/core/iwpm_util.c | 5 ++-- drivers/infiniband/core/iwpm_util.h | 1 + drivers/infiniband/core/netlink.c | 4 ++-- drivers/net/gtp.c | 3 ++- drivers/net/team/team.c | 5 ++-- drivers/net/wireless/mac80211_hwsim.c | 4 ++-- fs/dlm/netlink.c | 2 +- include/linux/netfilter/nfnetlink.h | 2 +- include/linux/netlink.h | 3 ++- include/linux/rtnetlink.h | 3 ++- include/net/genetlink.h | 13 +++++++---- include/net/netlink.h | 6 +++-- include/rdma/rdma_netlink.h | 3 ++- kernel/audit.c | 9 ++++---- kernel/taskstats.c | 4 ++-- net/core/devlink.c | 12 +++++----- net/core/net_namespace.c | 2 +- net/core/rtnetlink.c | 12 ++++++---- net/dcb/dcbnl.c | 2 +- net/decnet/dn_route.c | 3 ++- net/hsr/hsr_netlink.c | 6 +++-- net/ieee802154/ieee802154.h | 3 ++- net/ieee802154/netlink.c | 5 ++-- net/ieee802154/nl-mac.c | 4 ++-- net/ieee802154/nl-phy.c | 6 ++--- net/ieee802154/nl802154.c | 4 ++-- net/ipv4/devinet.c | 2 +- net/ipv4/fib_frontend.c | 2 +- net/ipv4/fou.c | 2 +- net/ipv4/inet_diag.c | 2 +- net/ipv4/ipmr.c | 6 +++-- net/ipv4/route.c | 2 +- net/ipv4/tcp_metrics.c | 2 +- net/ipv4/udp_diag.c | 2 +- net/ipv6/addrconf.c | 4 ++-- net/ipv6/addrlabel.c | 2 +- net/ipv6/ila/ila_xlat.c | 2 +- net/ipv6/ip6mr.c | 6 +++-- net/ipv6/route.c | 2 +- net/irda/irnetlink.c | 2 +- net/l2tp/l2tp_netlink.c | 8 ++++--- net/netfilter/ipset/ip_set_core.c | 11 +++++---- net/netfilter/ipvs/ip_vs_ctl.c | 2 +- net/netfilter/nf_conntrack_netlink.c | 9 +++++--- net/netfilter/nf_tables_api.c | 10 ++++---- net/netfilter/nfnetlink.c | 4 ++-- net/netfilter/nfnetlink_acct.c | 2 +- net/netfilter/nfnetlink_cthelper.c | 2 +- net/netfilter/nfnetlink_cttimeout.c | 5 ++-- net/netfilter/nfnetlink_log.c | 4 ++-- net/netfilter/nfnetlink_queue.c | 3 ++- net/netfilter/nft_compat.c | 4 ++-- net/netlabel/netlabel_cipso_v4.c | 2 +- net/netlabel/netlabel_mgmt.c | 4 ++-- net/netlabel/netlabel_unlabeled.c | 2 +- net/netlink/af_netlink.c | 14 +++++++----- net/netlink/genetlink.c | 2 +- net/nfc/netlink.c | 6 ++--- net/openvswitch/datapath.c | 9 ++++---- net/sched/act_api.c | 2 +- net/sctp/sctp_diag.c | 2 +- net/tipc/bearer.c | 4 ++-- net/tipc/netlink_compat.c | 2 +- net/tipc/node.c | 2 +- net/unix/diag.c | 2 +- net/wireless/nl80211.c | 43 ++++++++++++++++++----------------- net/xfrm/xfrm_user.c | 15 +++++++----- samples/connector/cn_test.c | 2 +- 72 files changed, 199 insertions(+), 155 deletions(-)
Signature · 1 line
2.7.4
RFC 1/7 netlink: Add allocation flag to netlink_unicast()
Though netlink_broadcast() has allocation flag which can specify memory allocation type (ex. GFP_KERNEL/GFP_ATOMIC), netlink_unicast() does not have it. This can cause "BUG: sleeping function called from invalid context at" with CONFIG_DEBUG_ATOMIC_SLEEP enabled kernel when calling netlink_unicast() inside RCU read-side section and not in IRQ.
This patch adds an allocation flag to netlink_unicast().
At this moment, the allocation flag could be zero to imply gfp_any(). This is a temporal functionality for stepwise modification and removed at the end of the series of patches.
--- drivers/connector/connector.c | 2 +- include/linux/netlink.h | 3 ++- include/net/netlink.h | 2 +- kernel/audit.c | 9 +++++---- net/core/rtnetlink.c | 2 +- net/ipv4/fib_frontend.c | 2 +- net/ipv4/inet_diag.c | 2 +- net/ipv4/udp_diag.c | 2 +- net/netfilter/ipset/ip_set_core.c | 11 +++++++---- net/netfilter/nf_conntrack_netlink.c | 9 ++++++--- net/netfilter/nfnetlink.c | 2 +- net/netfilter/nfnetlink_acct.c | 2 +- net/netfilter/nfnetlink_cthelper.c | 2 +- net/netfilter/nfnetlink_cttimeout.c | 5 +++-- net/netfilter/nft_compat.c | 4 ++-- net/netlink/af_netlink.c | 12 +++++++----- net/sctp/sctp_diag.c | 2 +- net/unix/diag.c | 2 +- samples/connector/cn_test.c | 2 +- 19 files changed, 44 insertions(+), 33 deletions(-)
drivers/connector/connector.c +1 -1
@@ -125,7 +125,7 @@ int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, u32 __group,return netlink_broadcast (dev->nls, skb, portid, group, gfp_mask);return netlink_unicast (dev->nls, skb, portid, - !gfpflags_allow_blocking (gfp_mask)); + !gfpflags_allow_blocking (gfp_mask), gfp_mask); }EXPORT_SYMBOL_GPL (cn_netlink_send_mult);
include/linux/netlink.h +2 -1
@@ -69,7 +69,8 @@ extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group)extern void netlink_ack (struct sk_buff *in_skb,struct nlmsghdr *nlh,int err);extern int netlink_has_listeners (struct sock *sk,unsigned int group); -extern int netlink_unicast (struct sock *ssk,struct sk_buff *skb,__u32 portid,int nonblock); +extern int netlink_unicast (struct sock *ssk,struct sk_buff *skb,__u32 portid, +int nonblock,gfp_t allocation);extern int netlink_broadcast (struct sock *ssk,struct sk_buff *skb,__u32 portid,__u32 group,gfp_t allocation); extern int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb,
include/net/netlink.h +1 -1
@@ -590,7 +590,7 @@ static inline int nlmsg_unicast(struct sock *sk, struct sk_buff *skb, u32 portid {int err; - err =netlink_unicast (sk, skb, portid,MSG_DONTWAIT ); + err =netlink_unicast (sk, skb, portid,MSG_DONTWAIT ,0 );if (err >0 ) err =0 ;
kernel/audit.c +5 -4
@@ -411,7 +411,7 @@ static void kauditd_send_skb(struct sk_buff *skb) restart:/* take a reference in case we can't send it and we want to hold it */ skb_get (skb); - err =netlink_unicast (audit_sock, skb, audit_nlk_portid,0 ); + err =netlink_unicast (audit_sock, skb, audit_nlk_portid,0 ,gfp_any ());if (err <0 ) {pr_err ("netlink_unicast sending to audit_pid=%d returned error: %d\n" , audit_pid, err);
@@ -547,7 +547,7 @@ int audit_send_list(void *_dest)mutex_unlock (&audit_cmd_mutex);while ((skb =__skb_dequeue (&dest->q)) !=NULL ) -netlink_unicast (aunet->nlsk, skb, dest->portid,0 ); +netlink_unicast (aunet->nlsk, skb, dest->portid,0 ,gfp_any ());put_net (net);kfree (dest);
@@ -591,7 +591,7 @@ static int audit_send_reply_thread(void *arg)/* Ignore failure. It'll only happen if the sender goes away, because our timeout is set to infinite. */ -netlink_unicast (aunet->nlsk , reply->skb, reply->portid,0 ); +netlink_unicast (aunet->nlsk , reply->skb, reply->portid,0 ,gfp_any ());put_net (net);kfree (reply);return 0 ;
@@ -814,7 +814,8 @@ static int audit_replace(pid_t pid)if (!skb)return -ENOMEM ; -return netlink_unicast (audit_sock, skb, audit_nlk_portid,0 ); +return netlink_unicast (audit_sock, skb, audit_nlk_portid,0 , +GFP_KERNEL ); }static int audit_receive_msg (struct sk_buff *skb,struct nlmsghdr *nlh)
net/core/rtnetlink.c +1 -1
@@ -649,7 +649,7 @@ int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int gatomic_inc (&skb->users);netlink_broadcast (rtnl, skb, pid, group,GFP_KERNEL );if (echo) - err =netlink_unicast (rtnl, skb, pid,MSG_DONTWAIT ); + err =netlink_unicast (rtnl, skb, pid,MSG_DONTWAIT ,GFP_KERNEL );return err; }
net/ipv4/fib_frontend.c +1 -1
@@ -1096,7 +1096,7 @@ static void nl_fib_input(struct sk_buff *skb) portid =NETLINK_CB (skb).portid;/* netlink portid */ NETLINK_CB (skb).portid =0 ;/* from kernel */ NETLINK_CB (skb).dst_group =0 ;/* unicast */ -netlink_unicast (net->ipv4.fibnl, skb, portid,MSG_DONTWAIT ); +netlink_unicast (net->ipv4.fibnl, skb, portid,MSG_DONTWAIT ,GFP_KERNEL ); }static int __net_init nl_fib_lookup_init (struct net *net)
net/ipv4/inet_diag.c +1 -1
@@ -441,7 +441,7 @@ int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, goto out; } err =netlink_unicast (net->diag_nlsk, rep,NETLINK_CB (in_skb).portid, -MSG_DONTWAIT ); +MSG_DONTWAIT ,GFP_KERNEL );if (err >0 ) err =0 ;
net/ipv4/udp_diag.c +1 -1
@@ -83,7 +83,7 @@ static int udp_dump_one(struct udp_table *tbl, struct sk_buff *in_skb, goto out; } err =netlink_unicast (net->diag_nlsk, rep,NETLINK_CB (in_skb).portid, -MSG_DONTWAIT ); +MSG_DONTWAIT ,GFP_KERNEL );if (err >0 ) err =0 ; out:
net/netfilter/ipset/ip_set_core.c +7 -4
@@ -1510,7 +1510,7 @@ call_ad(struct sock *ctnl, struct sk_buff *skb, struct ip_set *set, *errline = lineno;netlink_unicast (ctnl, skb2,NETLINK_CB (skb).portid, -MSG_DONTWAIT ); +MSG_DONTWAIT ,GFP_KERNEL );/* Signal netlink not to send its ACK/errmsg. */ return -EINTR ; }
@@ -1695,7 +1695,8 @@ static int ip_set_header(struct net *net, struct sock *ctnl, goto nla_put_failure;nlmsg_end (skb2, nlh2); - ret =netlink_unicast (ctnl, skb2,NETLINK_CB (skb).portid,MSG_DONTWAIT ); + ret =netlink_unicast (ctnl, skb2,NETLINK_CB (skb).portid,MSG_DONTWAIT , +GFP_KERNEL );if (ret <0 )return ret;
@@ -1755,7 +1756,8 @@ static int ip_set_type(struct net *net, struct sock *ctnl, struct sk_buff *skb,nlmsg_end (skb2, nlh2);pr_debug ("Send TYPE, nlmsg_len: %u\n" , nlh2->nlmsg_len); - ret =netlink_unicast (ctnl, skb2,NETLINK_CB (skb).portid,MSG_DONTWAIT ); + ret =netlink_unicast (ctnl, skb2,NETLINK_CB (skb).portid,MSG_DONTWAIT , +GFP_KERNEL );if (ret <0 )return ret;
@@ -1798,7 +1800,8 @@ static int ip_set_protocol(struct net *net, struct sock *ctnl, goto nla_put_failure;nlmsg_end (skb2, nlh2); - ret =netlink_unicast (ctnl, skb2,NETLINK_CB (skb).portid,MSG_DONTWAIT ); + ret =netlink_unicast (ctnl, skb2,NETLINK_CB (skb).portid,MSG_DONTWAIT , +GFP_KERNEL );if (ret <0 )return ret;
net/netfilter/nf_conntrack_netlink.c +6 -3
@@ -1224,7 +1224,8 @@ static int ctnetlink_get_conntrack(struct net *net, struct sock *ctnl,if (err <=0 ) goto free; - err =netlink_unicast (ctnl, skb2,NETLINK_CB (skb).portid,MSG_DONTWAIT ); + err =netlink_unicast (ctnl, skb2,NETLINK_CB (skb).portid,MSG_DONTWAIT , +GFP_KERNEL );if (err <0 ) goto out;
@@ -2083,7 +2084,8 @@ static int ctnetlink_stat_ct(struct net *net, struct sock *ctnl,if (err <=0 ) goto free; - err =netlink_unicast (ctnl, skb2,NETLINK_CB (skb).portid,MSG_DONTWAIT ); + err =netlink_unicast (ctnl, skb2,NETLINK_CB (skb).portid,MSG_DONTWAIT , +GFP_KERNEL );if (err <0 ) goto out;
@@ -2821,7 +2823,8 @@ static int ctnetlink_get_expect(struct net *net, struct sock *ctnl,if (err <=0 ) goto free; - err =netlink_unicast (ctnl, skb2,NETLINK_CB (skb).portid,MSG_DONTWAIT ); + err =netlink_unicast (ctnl, skb2,NETLINK_CB (skb).portid,MSG_DONTWAIT , +GFP_KERNEL );if (err <0 ) goto out;
net/netfilter/nfnetlink.c +1 -1
@@ -143,7 +143,7 @@ EXPORT_SYMBOL_GPL(nfnetlink_set_err);int nfnetlink_unicast (struct sk_buff *skb,struct net *net,u32 portid,int flags) { -return netlink_unicast (net->nfnl, skb, portid, flags); +return netlink_unicast (net->nfnl, skb, portid, flags,0 ); }EXPORT_SYMBOL_GPL (nfnetlink_unicast);
net/netfilter/nfnetlink_acct.c +1 -1
@@ -311,7 +311,7 @@ static int nfnl_acct_get(struct net *net, struct sock *nfnl,break ; } ret =netlink_unicast (nfnl, skb2,NETLINK_CB (skb).portid, -MSG_DONTWAIT ); +MSG_DONTWAIT ,GFP_KERNEL );if (ret >0 ) ret =0 ;
net/netfilter/nfnetlink_cthelper.c +1 -1
@@ -559,7 +559,7 @@ static int nfnl_cthelper_get(struct net *net, struct sock *nfnl, } ret =netlink_unicast (nfnl, skb2,NETLINK_CB (skb).portid, -MSG_DONTWAIT ); +MSG_DONTWAIT ,GFP_KERNEL );if (ret >0 ) ret =0 ;
net/netfilter/nfnetlink_cttimeout.c +3 -2
@@ -279,7 +279,7 @@ static int cttimeout_get_timeout(struct net *net, struct sock *ctnl,break ; } ret =netlink_unicast (ctnl, skb2,NETLINK_CB (skb).portid, -MSG_DONTWAIT ); +MSG_DONTWAIT ,GFP_KERNEL );if (ret >0 ) ret =0 ;
@@ -496,7 +496,8 @@ static int cttimeout_default_get(struct net *net, struct sock *ctnl, err = -ENOMEM ; goto err; } - ret =netlink_unicast (ctnl, skb2,NETLINK_CB (skb).portid,MSG_DONTWAIT ); + ret =netlink_unicast (ctnl, skb2,NETLINK_CB (skb).portid, +MSG_DONTWAIT ,GFP_KERNEL );if (ret >0 ) ret =0 ;
net/netfilter/nft_compat.c +2 -2
@@ -582,8 +582,8 @@ static int nfnl_compat_get(struct net *net, struct sock *nfnl,return -ENOSPC ; } - ret =netlink_unicast (nfnl, skb2,NETLINK_CB (skb).portid, -MSG_DONTWAIT ); + ret =netlink_unicast (nfnl, skb2,NETLINK_CB (skb).portid,MSG_DONTWAIT , +GFP_KERNEL );if (ret >0 ) ret =0 ;
net/netlink/af_netlink.c +7 -5
@@ -1220,14 +1220,14 @@ static int netlink_unicast_kernel(struct sock *sk, struct sk_buff *skb,return ret; } -int netlink_unicast (struct sock *ssk,struct sk_buff *skb, -u32 portid,int nonblock) +int netlink_unicast (struct sock *ssk,struct sk_buff *skb,u32 portid, +int nonblock,gfp_t allocation) {struct sock *sk;int err;long timeo; - skb =netlink_trim (skb,gfp_any ()); + skb =netlink_trim (skb, allocation ? allocation :gfp_any ()); timeo =sock_sndtimeo (ssk, nonblock); retry:
@@ -1783,7 +1783,8 @@ static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)atomic_inc (&skb->users);netlink_broadcast (sk, skb, dst_portid, dst_group,GFP_KERNEL ); } - err =netlink_unicast (sk, skb, dst_portid, msg->msg_flags&MSG_DONTWAIT ); + err =netlink_unicast (sk, skb, dst_portid, + msg->msg_flags &MSG_DONTWAIT ,GFP_KERNEL ); out:scm_destroy (&scm);
@@ -2250,7 +2251,8 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err) errmsg =nlmsg_data (rep); errmsg->error = err;memcpy (&errmsg->msg, nlh, payload >sizeof (*errmsg) ? nlh->nlmsg_len :sizeof (*nlh)); -netlink_unicast (in_skb->sk, skb,NETLINK_CB (in_skb).portid,MSG_DONTWAIT ); +netlink_unicast (in_skb->sk, skb,NETLINK_CB (in_skb).portid, +MSG_DONTWAIT ,GFP_KERNEL ); }EXPORT_SYMBOL (netlink_ack);
net/sctp/sctp_diag.c +1 -1
@@ -259,7 +259,7 @@ static int sctp_tsp_dump_one(struct sctp_transport *tsp, void *p) } err =netlink_unicast (net->diag_nlsk, rep,NETLINK_CB (in_skb).portid, -MSG_DONTWAIT ); +MSG_DONTWAIT ,GFP_KERNEL );if (err >0 ) err =0 ; out:
net/unix/diag.c +1 -1
@@ -280,7 +280,7 @@ again: goto again; } err =netlink_unicast (net->diag_nlsk, rep,NETLINK_CB (in_skb).portid, -MSG_DONTWAIT ); +MSG_DONTWAIT ,GFP_KERNEL );if (err >0 ) err =0 ; out:
samples/connector/cn_test.c +1 -1
@@ -116,7 +116,7 @@ static int cn_test_want_notify(void)NETLINK_CB (skb).dst_group = ctl->group;//netlink_broadcast(nls, skb, 0, ctl->group, GFP_ATOMIC); -netlink_unicast (nls, skb,0 ,0 ); +netlink_unicast (nls, skb,0 ,0 ,GFP_ATOMIC );pr_info ("request was sent: group=0x%x\n" , ctl->group);
Signature · 1 line
2.7.4
RFC 2/7 netfilter: Add allocation flag to nfnetlink_unicast()
In reply to Masashi Honma--- include/linux/netfilter/nfnetlink.h | 2 +- net/netfilter/nfnetlink.c | 4 ++-- net/netfilter/nfnetlink_log.c | 4 ++-- net/netfilter/nfnetlink_queue.c | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-)
include/linux/netfilter/nfnetlink.h +1 -1
@@ -38,7 +38,7 @@ int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid, unsigned int group, int echo, gfp_t flags);int nfnetlink_set_err (struct net *net,u32 portid,u32 group,int error);int nfnetlink_unicast (struct sk_buff *skb,struct net *net,u32 portid, -int flags); +int flags,gfp_t allocation);void nfnl_lock (__u8 subsys_id);void nfnl_unlock (__u8 subsys_id);
net/netfilter/nfnetlink.c +2 -2
@@ -141,9 +141,9 @@ int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error)EXPORT_SYMBOL_GPL (nfnetlink_set_err);int nfnetlink_unicast (struct sk_buff *skb,struct net *net,u32 portid, -int flags) +int flags,gfp_t allocation) { -return netlink_unicast (net->nfnl, skb, portid, flags,0 ); +return netlink_unicast (net->nfnl, skb, portid, flags, allocation); }EXPORT_SYMBOL_GPL (nfnetlink_unicast);
net/netfilter/nfnetlink_log.c +2 -2
@@ -357,8 +357,8 @@ __nfulnl_send(struct nfulnl_instance *inst) goto out; } } -nfnetlink_unicast (inst->skb, inst->net, inst->peer_portid, -MSG_DONTWAIT ); +nfnetlink_unicast (inst->skb, inst->net, inst->peer_portid,MSG_DONTWAIT , +gfp_any ()); out: inst->qlen =0 ; inst->skb =NULL ;
net/netfilter/nfnetlink_queue.c +2 -1
@@ -638,7 +638,8 @@ __nfqnl_enqueue_packet(struct net *net, struct nfqnl_instance *queue, *packet_id_ptr =htonl (entry->id);/* nfnetlink_unicast will either free the nskb or add it to a socket */ - err =nfnetlink_unicast (nskb, net, queue->peer_portid,MSG_DONTWAIT ); + err =nfnetlink_unicast (nskb, net, queue->peer_portid,MSG_DONTWAIT , +GFP_ATOMIC );if (err <0 ) {if (queue->flags &NFQA_CFG_F_FAIL_OPEN ) { failopen =1 ;
Signature · 1 line
2.7.4
RFC 3/7 netlink: Add allocation flag to nlmsg_unicast()
In reply to Masashi Honma--- crypto/crypto_user.c | 3 ++- drivers/infiniband/core/netlink.c | 2 +- include/net/genetlink.h | 2 +- include/net/netlink.h | 6 ++++-- net/core/rtnetlink.c | 2 +- net/netfilter/nf_tables_api.c | 10 +++++----- net/netlink/af_netlink.c | 2 +- net/xfrm/xfrm_user.c | 15 +++++++++------ 8 files changed, 24 insertions(+), 18 deletions(-)
crypto/crypto_user.c +2 -1
@@ -249,7 +249,8 @@ drop_alg:if (err)return err; -return nlmsg_unicast (crypto_nlsk, skb,NETLINK_CB (in_skb).portid); +return nlmsg_unicast (crypto_nlsk, skb,NETLINK_CB (in_skb).portid, +GFP_ATOMIC ); }static int crypto_dump_report (struct sk_buff *skb,struct netlink_callback *cb)
drivers/infiniband/core/netlink.c +1 -1
@@ -229,7 +229,7 @@ static void ibnl_rcv(struct sk_buff *skb)int ibnl_unicast (struct sk_buff *skb,struct nlmsghdr *nlh,__u32 pid) { -return nlmsg_unicast (nls, skb, pid); +return nlmsg_unicast (nls, skb, pid,gfp_any ()); }EXPORT_SYMBOL (ibnl_unicast);
include/net/genetlink.h +1 -1
@@ -334,7 +334,7 @@ int genlmsg_multicast_allns(struct genl_family *family,*/ static inline int genlmsg_unicast (struct net *net,struct sk_buff *skb,u32 portid) { -return nlmsg_unicast (net->genl_sock, skb, portid); +return nlmsg_unicast (net->genl_sock, skb, portid,0 ); }/**
include/net/netlink.h +4 -2
@@ -585,12 +585,14 @@ static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb,* @sk: netlink socket to spread message to * @skb: netlink message as socket buffer * @portid: netlink portid of the destination socket +* @flags: allocation flags */ -static inline int nlmsg_unicast (struct sock *sk,struct sk_buff *skb,u32 portid) +static inline int nlmsg_unicast (struct sock *sk,struct sk_buff *skb, +u32 portid,gfp_t flags) {int err; - err =netlink_unicast (sk, skb, portid,MSG_DONTWAIT ,0 ); + err =netlink_unicast (sk, skb, portid,MSG_DONTWAIT , flags);if (err >0 ) err =0 ;
net/core/rtnetlink.c +1 -1
@@ -657,7 +657,7 @@ int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid) {struct sock *rtnl = net->rtnl; -return nlmsg_unicast (rtnl, skb, pid); +return nlmsg_unicast (rtnl, skb, pid,gfp_any ()); }EXPORT_SYMBOL (rtnl_unicast);
net/netfilter/nf_tables_api.c +5 -5
@@ -581,7 +581,7 @@ static int nf_tables_gettable(struct net *net, struct sock *nlsk,if (err <0 ) goto err; -return nlmsg_unicast (nlsk, skb2,NETLINK_CB (skb).portid); +return nlmsg_unicast (nlsk, skb2,NETLINK_CB (skb).portid,GFP_KERNEL ); err:kfree_skb (skb2);
@@ -1144,7 +1144,7 @@ static int nf_tables_getchain(struct net *net, struct sock *nlsk,if (err <0 ) goto err; -return nlmsg_unicast (nlsk, skb2,NETLINK_CB (skb).portid); +return nlmsg_unicast (nlsk, skb2,NETLINK_CB (skb).portid,GFP_KERNEL ); err:kfree_skb (skb2);
@@ -1976,7 +1976,7 @@ static int nf_tables_getrule(struct net *net, struct sock *nlsk,if (err <0 ) goto err; -return nlmsg_unicast (nlsk, skb2,NETLINK_CB (skb).portid); +return nlmsg_unicast (nlsk, skb2,NETLINK_CB (skb).portid,GFP_KERNEL ); err:kfree_skb (skb2);
@@ -2664,7 +2664,7 @@ static int nf_tables_getset(struct net *net, struct sock *nlsk,if (err <0 ) goto err; -return nlmsg_unicast (nlsk, skb2,NETLINK_CB (skb).portid); +return nlmsg_unicast (nlsk, skb2,NETLINK_CB (skb).portid,GFP_KERNEL ); err:kfree_skb (skb2);
@@ -3798,7 +3798,7 @@ static int nf_tables_getgen(struct net *net, struct sock *nlsk,if (err <0 ) goto err; -return nlmsg_unicast (nlsk, skb2,NETLINK_CB (skb).portid); +return nlmsg_unicast (nlsk, skb2,NETLINK_CB (skb).portid,GFP_KERNEL ); err:kfree_skb (skb2);return err;
net/netlink/af_netlink.c +1 -1
@@ -2328,7 +2328,7 @@ int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 portid,if (report) {int err2; - err2 =nlmsg_unicast (sk, skb, portid); + err2 =nlmsg_unicast (sk, skb, portid, flags);if (!err || err == -ESRCH ) err = err2; }
net/xfrm/xfrm_user.c +9 -6
@@ -1108,7 +1108,7 @@ static int xfrm_get_spdinfo(struct sk_buff *skb, struct nlmsghdr *nlh,if (build_spdinfo (r_skb, net, sportid, seq, *flags) <0 )BUG (); -return nlmsg_unicast (net->xfrm.nlsk, r_skb, sportid); +return nlmsg_unicast (net->xfrm.nlsk, r_skb, sportid,GFP_ATOMIC ); }static inline size_t xfrm_sadinfo_msgsize (void )
@@ -1166,7 +1166,7 @@ static int xfrm_get_sadinfo(struct sk_buff *skb, struct nlmsghdr *nlh,if (build_sadinfo (r_skb, net, sportid, seq, *flags) <0 )BUG (); -return nlmsg_unicast (net->xfrm.nlsk, r_skb, sportid); +return nlmsg_unicast (net->xfrm.nlsk, r_skb, sportid,GFP_ATOMIC ); } static int xfrm_get_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
@@ -1186,7 +1186,8 @@ static int xfrm_get_sa(struct sk_buff *skb, struct nlmsghdr *nlh,if (IS_ERR (resp_skb)) { err =PTR_ERR (resp_skb); }else { - err =nlmsg_unicast (net->xfrm.nlsk, resp_skb,NETLINK_CB (skb).portid); + err =nlmsg_unicast (net->xfrm.nlsk, resp_skb, +NETLINK_CB (skb).portid,GFP_ATOMIC ); }xfrm_state_put (x); out_noput:
@@ -1244,7 +1245,8 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh, goto out; } - err =nlmsg_unicast (net->xfrm.nlsk, resp_skb,NETLINK_CB (skb).portid); + err =nlmsg_unicast (net->xfrm.nlsk, resp_skb,NETLINK_CB (skb).portid, +GFP_ATOMIC ); out:xfrm_state_put (x);
@@ -1760,7 +1762,7 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, err =PTR_ERR (resp_skb); }else { err =nlmsg_unicast (net->xfrm.nlsk, resp_skb, -NETLINK_CB (skb).portid); +NETLINK_CB (skb).portid,GFP_KERNEL ); } }else {xfrm_audit_policy_delete (xp, err ?0 :1 , true);
@@ -1914,7 +1916,8 @@ static int xfrm_get_ae(struct sk_buff *skb, struct nlmsghdr *nlh,if (build_aevent (r_skb, x, &c) <0 )BUG (); - err =nlmsg_unicast (net->xfrm.nlsk, r_skb,NETLINK_CB (skb).portid); + err =nlmsg_unicast (net->xfrm.nlsk, r_skb,NETLINK_CB (skb).portid, +GFP_ATOMIC );spin_unlock_bh (&x->lock);xfrm_state_put (x);return err;
Signature · 1 line
2.7.4
RFC 4/7 infiniband: Add allocation flag to ibnl_unicast()
In reply to Masashi Honma--- drivers/infiniband/core/iwpm_msg.c | 6 +++--- drivers/infiniband/core/iwpm_util.c | 5 +++-- drivers/infiniband/core/iwpm_util.h | 1 + drivers/infiniband/core/netlink.c | 4 ++-- include/rdma/rdma_netlink.h | 3 ++- 5 files changed, 11 insertions(+), 8 deletions(-)
drivers/infiniband/core/iwpm_msg.c +3 -3
@@ -174,7 +174,7 @@ int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client) goto add_mapping_error; nlmsg_request->req_buffer = pm_msg; - ret =ibnl_unicast (skb, nlh, iwpm_user_pid); + ret =ibnl_unicast (skb, nlh, iwpm_user_pid,GFP_ATOMIC );if (ret) { skb =NULL ;/* skb is freed in the netlink send-op handling */ iwpm_user_pid =IWPM_PID_UNDEFINED ;
@@ -251,7 +251,7 @@ int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client) goto query_mapping_error; nlmsg_request->req_buffer = pm_msg; - ret =ibnl_unicast (skb, nlh, iwpm_user_pid); + ret =ibnl_unicast (skb, nlh, iwpm_user_pid,GFP_ATOMIC );if (ret) { skb =NULL ;/* skb is freed in the netlink send-op handling */ err_str ="Unable to send a nlmsg" ;
@@ -312,7 +312,7 @@ int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client)if (ret) goto remove_mapping_error; - ret =ibnl_unicast (skb, nlh, iwpm_user_pid); + ret =ibnl_unicast (skb, nlh, iwpm_user_pid,GFP_ATOMIC );if (ret) { skb =NULL ;/* skb is freed in the netlink send-op handling */ iwpm_user_pid =IWPM_PID_UNDEFINED ;
drivers/infiniband/core/iwpm_util.c +3 -2
@@ -609,7 +609,7 @@ static int send_mapinfo_num(u32 mapping_num, u8 nl_client, int iwpm_pid) &mapping_num, IWPM_NLA_MAPINFO_SEND_NUM);if (ret) goto mapinfo_num_error; - ret =ibnl_unicast (skb, nlh, iwpm_pid); + ret =ibnl_unicast (skb, nlh, iwpm_pid,GFP_ATOMIC );if (ret) { skb =NULL ; err_str ="Unable to send a nlmsg" ;
@@ -638,7 +638,8 @@ static int send_nlmsg_done(struct sk_buff *skb, u8 nl_client, int iwpm_pid)return -ENOMEM ; } nlh->nlmsg_type =NLMSG_DONE ; - ret =ibnl_unicast (skb, (struct nlmsghdr *)skb->data, iwpm_pid); + ret =ibnl_unicast (skb, (struct nlmsghdr *)skb->data, iwpm_pid, +GFP_ATOMIC );if (ret)pr_warn ("%s Unable to send a nlmsg\n" , __func__);return ret;
drivers/infiniband/core/iwpm_util.h +1 -0
@@ -46,6 +46,7 @@#include <linux/jhash.h> #include <linux/kref.h> #include <net/netlink.h> +#include <net/sock.h> #include <linux/errno.h> #include <rdma/iw_portmap.h> #include <rdma/rdma_netlink.h>
drivers/infiniband/core/netlink.c +2 -2
@@ -227,9 +227,9 @@ static void ibnl_rcv(struct sk_buff *skb) }int ibnl_unicast (struct sk_buff *skb,struct nlmsghdr *nlh, -__u32 pid) +__u32 pid,gfp_t flags) { -return nlmsg_unicast (nls, skb, pid,gfp_any ()); +return nlmsg_unicast (nls, skb, pid, flags); }EXPORT_SYMBOL (ibnl_unicast);
include/rdma/rdma_netlink.h +2 -1
@@ -61,10 +61,11 @@ int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh,* @skb: The netlink skb * @nlh: Header of the netlink message to send * @pid: Userspace netlink process ID +* @flags: allocation flags * Returns 0 on success or a negative error code. */ int ibnl_unicast (struct sk_buff *skb,struct nlmsghdr *nlh, -__u32 pid); +__u32 pid,gfp_t flags);/** * Send the supplied skb to a netlink group.
Signature · 1 line
2.7.4
RFC 5/7 net: Add allocation flag to rtnl_unicast()
In reply to Masashi Honma--- include/linux/rtnetlink.h | 3 ++- net/core/net_namespace.c | 2 +- net/core/rtnetlink.c | 10 ++++++---- net/dcb/dcbnl.c | 2 +- net/decnet/dn_route.c | 3 ++- net/ipv4/devinet.c | 2 +- net/ipv4/ipmr.c | 6 ++++-- net/ipv4/route.c | 2 +- net/ipv6/addrconf.c | 4 ++-- net/ipv6/addrlabel.c | 2 +- net/ipv6/ip6mr.c | 6 ++++-- net/ipv6/route.c | 2 +- net/sched/act_api.c | 2 +- 13 files changed, 27 insertions(+), 19 deletions(-)
include/linux/rtnetlink.h +2 -1
@@ -8,7 +8,8 @@#include <uapi/linux/rtnetlink.h> extern int rtnetlink_send (struct sk_buff *skb,struct net *net,u32 pid,u32 group,int echo); -extern int rtnl_unicast (struct sk_buff *skb,struct net *net,u32 pid); +extern int rtnl_unicast (struct sk_buff *skb,struct net *net,u32 pid, +gfp_t flags);extern void rtnl_notify (struct sk_buff *skb,struct net *net,u32 pid,u32 group,struct nlmsghdr *nlh,gfp_t flags);extern void rtnl_set_sk_err (struct net *net,u32 group,int error);
net/core/net_namespace.c +1 -1
@@ -646,7 +646,7 @@ static int rtnl_net_getid(struct sk_buff *skb, struct nlmsghdr *nlh)if (err <0 ) goto err_out; - err =rtnl_unicast (msg, net,NETLINK_CB (skb).portid); + err =rtnl_unicast (msg, net,NETLINK_CB (skb).portid,GFP_KERNEL ); goto out; err_out:
net/core/rtnetlink.c +6 -4
@@ -653,11 +653,11 @@ int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int greturn err; } -int rtnl_unicast (struct sk_buff *skb,struct net *net,u32 pid) +int rtnl_unicast (struct sk_buff *skb,struct net *net,u32 pid,gfp_t flags) {struct sock *rtnl = net->rtnl; -return nlmsg_unicast (rtnl, skb, pid,gfp_any ()); +return nlmsg_unicast (rtnl, skb, pid, flags); }EXPORT_SYMBOL (rtnl_unicast);
@@ -2565,7 +2565,8 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh)WARN_ON (err == -EMSGSIZE );kfree_skb (nskb); }else - err =rtnl_unicast (nskb, net,NETLINK_CB (skb).portid); + err =rtnl_unicast (nskb, net,NETLINK_CB (skb).portid, +GFP_KERNEL );return err; }
@@ -3601,7 +3602,8 @@ static int rtnl_stats_get(struct sk_buff *skb, struct nlmsghdr *nlh)WARN_ON (err == -EMSGSIZE );kfree_skb (nskb); }else { - err =rtnl_unicast (nskb, net,NETLINK_CB (skb).portid); + err =rtnl_unicast (nskb, net,NETLINK_CB (skb).portid, +GFP_KERNEL ); }return err;
net/dcb/dcbnl.c +1 -1
@@ -1749,7 +1749,7 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh)nlmsg_end (reply_skb, reply_nlh); - ret =rtnl_unicast (reply_skb, net, portid); + ret =rtnl_unicast (reply_skb, net, portid,GFP_KERNEL ); out:return ret; }
net/decnet/dn_route.c +2 -1
@@ -1714,7 +1714,8 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh) goto out_free; } -return rtnl_unicast (skb, &init_net,NETLINK_CB (in_skb).portid); +return rtnl_unicast (skb, &init_net,NETLINK_CB (in_skb).portid, +GFP_KERNEL ); out_free:kfree_skb (skb);
net/ipv4/devinet.c +1 -1
@@ -1917,7 +1917,7 @@ static int inet_netconf_get_devconf(struct sk_buff *in_skb,kfree_skb (skb); goto errout; } - err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid); + err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid,GFP_ATOMIC ); errout:return err; }
net/ipv4/ipmr.c +4 -2
@@ -654,7 +654,8 @@ static void ipmr_destroy_unres(struct mr_table *mrt, struct mfc_cache *c) e->error = -ETIMEDOUT ;memset (&e->msg,0 ,sizeof (e->msg)); -rtnl_unicast (skb, net,NETLINK_CB (skb).portid); +rtnl_unicast (skb, net,NETLINK_CB (skb).portid, +gfp_any ()); }else {kfree_skb (skb); }
@@ -933,7 +934,8 @@ static void ipmr_cache_resolve(struct net *net, struct mr_table *mrt,memset (&e->msg,0 ,sizeof (e->msg)); } -rtnl_unicast (skb, net,NETLINK_CB (skb).portid); +rtnl_unicast (skb, net,NETLINK_CB (skb).portid, +gfp_any ()); }else {ip_mr_forward (net, mrt, skb, c,0 ); }
net/ipv4/route.c +1 -1
@@ -2621,7 +2621,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh)if (err <0 ) goto errout_free; - err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid); + err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid,GFP_KERNEL ); errout:return err;
net/ipv6/addrconf.c +2 -2
@@ -628,7 +628,7 @@ static int inet6_netconf_get_devconf(struct sk_buff *in_skb,kfree_skb (skb); goto errout; } - err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid); + err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid,GFP_ATOMIC ); errout:return err; }
@@ -4824,7 +4824,7 @@ static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr *nlh)kfree_skb (skb); goto errout_ifa; } - err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid); + err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid,GFP_KERNEL ); errout_ifa:in6_ifa_put (ifa); errout:
net/ipv6/addrlabel.c +1 -1
@@ -580,7 +580,7 @@ static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr *nlh) goto out; } - err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid); + err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid,GFP_KERNEL ); out:return err; }
net/ipv6/ip6mr.c +4 -2
@@ -850,7 +850,8 @@ static void ip6mr_destroy_unres(struct mr6_table *mrt, struct mfc6_cache *c) nlh->nlmsg_len =nlmsg_msg_size (sizeof (struct nlmsgerr ));skb_trim (skb, nlh->nlmsg_len); ((struct nlmsgerr *)nlmsg_data (nlh))->error = -ETIMEDOUT ; -rtnl_unicast (skb, net,NETLINK_CB (skb).portid); +rtnl_unicast (skb, net,NETLINK_CB (skb).portid, +gfp_any ()); }else kfree_skb (skb); }
@@ -1114,7 +1115,8 @@ static void ip6mr_cache_resolve(struct net *net, struct mr6_table *mrt,skb_trim (skb, nlh->nlmsg_len); ((struct nlmsgerr *)nlmsg_data (nlh))->error = -EMSGSIZE ; } -rtnl_unicast (skb, net,NETLINK_CB (skb).portid); +rtnl_unicast (skb, net,NETLINK_CB (skb).portid, +gfp_any ()); }else ip6_mr_forward (net, mrt, skb, c); }
net/ipv6/route.c +1 -1
@@ -3367,7 +3367,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh) goto errout; } - err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid); + err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid,GFP_KERNEL ); errout:return err; }
net/sched/act_api.c +1 -1
@@ -737,7 +737,7 @@ act_get_notify(struct net *net, u32 portid, struct nlmsghdr *n,return -EINVAL ; } -return rtnl_unicast (skb, net, portid); +return rtnl_unicast (skb, net, portid,GFP_KERNEL ); }static struct tc_action *create_a (int i)
Signature · 1 line
2.7.4
RFC 6/7 genetlink: Add allocation flag to genlmsg_unicast()
In reply to a message not in the archive--- drivers/net/gtp.c | 3 ++- drivers/net/team/team.c | 5 +++-- drivers/net/wireless/mac80211_hwsim.c | 2 +- fs/dlm/netlink.c | 2 +- include/net/genetlink.h | 8 +++++--- kernel/taskstats.c | 2 +- net/hsr/hsr_netlink.c | 6 ++++-- net/l2tp/l2tp_netlink.c | 8 +++++--- net/openvswitch/datapath.c | 3 ++- net/tipc/netlink_compat.c | 2 +- net/wireless/nl80211.c | 9 +++++---- 11 files changed, 30 insertions(+), 20 deletions(-)
drivers/net/gtp.c +2 -1
@@ -1210,7 +1210,8 @@ static int gtp_genl_get_pdp(struct sk_buff *skb, struct genl_info *info) goto err_unlock_free;rcu_read_unlock (); -return genlmsg_unicast (genl_info_net (info), skb2, info->snd_portid); +return genlmsg_unicast (genl_info_net (info), skb2, info->snd_portid, +GFP_ATOMIC ); err_unlock_free:kfree_skb (skb2);
drivers/net/team/team.c +3 -2
@@ -2194,7 +2194,8 @@ static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)genlmsg_end (msg, hdr); -return genlmsg_unicast (genl_info_net (info), msg, info->snd_portid); +return genlmsg_unicast (genl_info_net (info), msg, info->snd_portid, +GFP_KERNEL ); err_msg_put:nlmsg_free (msg);
@@ -2240,7 +2241,7 @@ typedef int team_nl_send_func_t(struct sk_buff *skb,static int team_nl_send_unicast (struct sk_buff *skb,struct team *team,u32 portid) { -return genlmsg_unicast (dev_net (team->dev), skb, portid); +return genlmsg_unicast (dev_net (team->dev), skb, portid,gfp_any ()); } static int team_nl_fill_one_option_get(struct sk_buff *skb, struct team *team,
drivers/net/wireless/mac80211_hwsim.c +1 -1
@@ -1008,7 +1008,7 @@ static int hwsim_unicast_netgroup(struct mac80211_hwsim_data *data,rcu_read_lock ();for_each_net_rcu (net) {if (data->netgroup ==hwsim_net_get_netgroup (net)) { - res =genlmsg_unicast (net, skb, portid); + res =genlmsg_unicast (net, skb, portid,GFP_ATOMIC ); found = true;break ; }
fs/dlm/netlink.c +1 -1
@@ -59,7 +59,7 @@ static int send_data(struct sk_buff *skb)genlmsg_end (skb, data); -return genlmsg_unicast (&init_net, skb, listener_nlportid); +return genlmsg_unicast (&init_net, skb, listener_nlportid,GFP_NOFS ); }static int user_cmd (struct sk_buff *skb,struct genl_info *info)
include/net/genetlink.h +5 -3
@@ -331,10 +331,12 @@ int genlmsg_multicast_allns(struct genl_family *family,* genlmsg_unicast - unicast a netlink message * @skb: netlink message as socket buffer * @portid: netlink portid of the destination socket +* @flags: allocation flags */ -static inline int genlmsg_unicast (struct net *net,struct sk_buff *skb,u32 portid) +static inline int genlmsg_unicast (struct net *net,struct sk_buff *skb, +u32 portid,gfp_t flags) { -return nlmsg_unicast (net->genl_sock, skb, portid,0 ); +return nlmsg_unicast (net->genl_sock, skb, portid, flags); }/**
@@ -344,7 +346,7 @@ static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 port*/ static inline int genlmsg_reply (struct sk_buff *skb,struct genl_info *info) { -return genlmsg_unicast (genl_info_net (info), skb, info->snd_portid); +return genlmsg_unicast (genl_info_net (info), skb, info->snd_portid,0 ); }/**
kernel/taskstats.c +1 -1
@@ -140,7 +140,7 @@ static void send_cpu_listeners(struct sk_buff *skb,if (!skb_next)break ; } - rc =genlmsg_unicast (&init_net, skb_cur, s->pid); + rc =genlmsg_unicast (&init_net, skb_cur, s->pid,GFP_KERNEL );if (rc == -ECONNREFUSED ) { s->valid =0 ; delcount++;
net/hsr/hsr_netlink.c +4 -2
@@ -351,7 +351,8 @@ static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info) goto nla_put_failure;genlmsg_end (skb_out, msg_head); -genlmsg_unicast (genl_info_net (info), skb_out, info->snd_portid); +genlmsg_unicast (genl_info_net (info), skb_out, info->snd_portid, +GFP_KERNEL );return 0 ;
@@ -433,7 +434,8 @@ static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info)rcu_read_unlock ();genlmsg_end (skb_out, msg_head); -genlmsg_unicast (genl_info_net (info), skb_out, info->snd_portid); +genlmsg_unicast (genl_info_net (info), skb_out, info->snd_portid, +GFP_KERNEL );return 0 ;
net/l2tp/l2tp_netlink.c +5 -3
@@ -100,7 +100,8 @@ static int l2tp_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)genlmsg_end (msg, hdr); -return genlmsg_unicast (genl_info_net (info), msg, info->snd_portid); +return genlmsg_unicast (genl_info_net (info), msg, info->snd_portid, +GFP_KERNEL ); err_out:nlmsg_free (msg);
@@ -450,7 +451,7 @@ static int l2tp_nl_cmd_tunnel_get(struct sk_buff *skb, struct genl_info *info)if (ret <0 ) goto err_out; -return genlmsg_unicast (net, msg, info->snd_portid); +return genlmsg_unicast (net, msg, info->snd_portid,GFP_KERNEL ); err_out:nlmsg_free (msg);
@@ -820,7 +821,8 @@ static int l2tp_nl_cmd_session_get(struct sk_buff *skb, struct genl_info *info)if (ret <0 ) goto err_out; -return genlmsg_unicast (genl_info_net (info), msg, info->snd_portid); +return genlmsg_unicast (genl_info_net (info), msg, info->snd_portid, +GFP_KERNEL ); err_out:nlmsg_free (msg);
net/openvswitch/datapath.c +2 -1
@@ -542,7 +542,8 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, ((struct nlmsghdr *) user_skb->data)->nlmsg_len = user_skb->len; - err =genlmsg_unicast (ovs_dp_get_net (dp), user_skb, upcall_info->portid); + err =genlmsg_unicast (ovs_dp_get_net (dp), user_skb, upcall_info->portid, +GFP_ATOMIC ); user_skb =NULL ; out:if (err)
net/tipc/netlink_compat.c +1 -1
@@ -1210,7 +1210,7 @@ send: rep_nlh =nlmsg_hdr (msg.rep);memcpy (rep_nlh, info->nlhdr, len); rep_nlh->nlmsg_len = msg.rep->len; -genlmsg_unicast (msg.net, msg.rep,NETLINK_CB (skb).portid); +genlmsg_unicast (msg.net, msg.rep,NETLINK_CB (skb).portid,GFP_KERNEL );return err; }
net/wireless/nl80211.c +5 -4
@@ -12648,7 +12648,7 @@ static bool __nl80211_unexpected_frame(struct net_device *dev, u8 cmd, goto nla_put_failure;genlmsg_end (msg, hdr); -genlmsg_unicast (wiphy_net (&rdev->wiphy), msg, nlportid); +genlmsg_unicast (wiphy_net (&rdev->wiphy), msg, nlportid, gfp);return true; nla_put_failure:
@@ -12733,7 +12733,7 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,genlmsg_end (msg, hdr); -return genlmsg_unicast (wiphy_net (&rdev->wiphy), msg, nlportid); +return genlmsg_unicast (wiphy_net (&rdev->wiphy), msg, nlportid, gfp); nla_put_failure:genlmsg_cancel (msg, hdr);
@@ -13245,7 +13245,8 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,genlmsg_end (msg, hdr); -genlmsg_unicast (wiphy_net (&rdev->wiphy), msg, reg->nlportid); +genlmsg_unicast (wiphy_net (&rdev->wiphy), msg, reg->nlportid, +GFP_ATOMIC ); }spin_unlock_bh (&rdev->beacon_registrations_lock);return ;
@@ -13623,7 +13624,7 @@ void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp)genlmsg_end (msg, hdr); -genlmsg_unicast (wiphy_net (&rdev->wiphy), msg, nlportid); +genlmsg_unicast (wiphy_net (&rdev->wiphy), msg, nlportid, gfp);return ; nla_put_failure:
Signature · 1 line
2.7.4
RFC 7/7 genetlink: Add allocation flag to genlmsg_reply()
In reply to a message not in the archiveAdd allocation flag to genlmsg_reply() and remove netlink_unicast() temporal functionality for stepwise modification.
--- drivers/block/drbd/drbd_nl.c | 2 +- drivers/net/wireless/mac80211_hwsim.c | 2 +- include/net/genetlink.h | 7 +++++-- kernel/taskstats.c | 2 +- net/core/devlink.c | 12 ++++++------ net/ieee802154/ieee802154.h | 3 ++- net/ieee802154/netlink.c | 5 +++-- net/ieee802154/nl-mac.c | 4 ++-- net/ieee802154/nl-phy.c | 6 +++--- net/ieee802154/nl802154.c | 4 ++-- net/ipv4/fou.c | 2 +- net/ipv4/tcp_metrics.c | 2 +- net/ipv6/ila/ila_xlat.c | 2 +- net/irda/irnetlink.c | 2 +- net/netfilter/ipvs/ip_vs_ctl.c | 2 +- net/netlabel/netlabel_cipso_v4.c | 2 +- net/netlabel/netlabel_mgmt.c | 4 ++-- net/netlabel/netlabel_unlabeled.c | 2 +- net/netlink/af_netlink.c | 2 +- net/netlink/genetlink.c | 2 +- net/nfc/netlink.c | 6 +++--- net/openvswitch/datapath.c | 6 +++--- net/tipc/bearer.c | 4 ++-- net/tipc/node.c | 2 +- net/wireless/nl80211.c | 34 +++++++++++++++++----------------- 25 files changed, 63 insertions(+), 58 deletions(-)
drivers/block/drbd/drbd_nl.c +1 -1
@@ -100,7 +100,7 @@ static char *drbd_m_holder = "Hands off! this is DRBD's meta data device.";static void drbd_adm_send_reply (struct sk_buff *skb,struct genl_info *info) {genlmsg_end (skb,genlmsg_data (nlmsg_data (nlmsg_hdr (skb)))); -if (genlmsg_reply (skb, info)) +if (genlmsg_reply (skb, info,GFP_KERNEL ))pr_err ("error sending genl reply\n" ); }
drivers/net/wireless/mac80211_hwsim.c +1 -1
@@ -3160,7 +3160,7 @@ static int hwsim_get_radio_nl(struct sk_buff *msg, struct genl_info *info) goto out_err; } -genlmsg_reply (skb, info); +genlmsg_reply (skb, info,GFP_KERNEL );break ; }
include/net/genetlink.h +5 -2
@@ -343,10 +343,13 @@ static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb,* genlmsg_reply - reply to a request * @skb: netlink message to be sent back * @info: receiver information +* @flags: allocation flags */ -static inline int genlmsg_reply (struct sk_buff *skb,struct genl_info *info) +static inline int genlmsg_reply (struct sk_buff *skb,struct genl_info *info, +gfp_t flags) { -return genlmsg_unicast (genl_info_net (info), skb, info->snd_portid,0 ); +return genlmsg_unicast (genl_info_net (info), skb, info->snd_portid, + flags); }/**
kernel/taskstats.c +1 -1
@@ -114,7 +114,7 @@ static int send_reply(struct sk_buff *skb, struct genl_info *info)genlmsg_end (skb, reply); -return genlmsg_reply (skb, info); +return genlmsg_reply (skb, info,GFP_KERNEL ); }/*
net/core/devlink.c +6 -6
@@ -501,7 +501,7 @@ static int devlink_nl_cmd_get_doit(struct sk_buff *skb, struct genl_info *info)return err; } -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); } static int devlink_nl_cmd_get_dumpit(struct sk_buff *msg,
@@ -554,7 +554,7 @@ static int devlink_nl_cmd_port_get_doit(struct sk_buff *skb,return err; } -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); } static int devlink_nl_cmd_port_get_dumpit(struct sk_buff *msg,
@@ -736,7 +736,7 @@ static int devlink_nl_cmd_sb_get_doit(struct sk_buff *skb,return err; } -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); } static int devlink_nl_cmd_sb_get_dumpit(struct sk_buff *msg,
@@ -843,7 +843,7 @@ static int devlink_nl_cmd_sb_pool_get_doit(struct sk_buff *skb,return err; } -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); } static int __sb_pool_get_dumpit(struct sk_buff *msg, int start, int *p_idx,
@@ -1030,7 +1030,7 @@ static int devlink_nl_cmd_sb_port_pool_get_doit(struct sk_buff *skb,return err; } -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); } static int __sb_port_pool_get_dumpit(struct sk_buff *msg, int start, int *p_idx,
@@ -1233,7 +1233,7 @@ static int devlink_nl_cmd_sb_tc_pool_bind_get_doit(struct sk_buff *skb,return err; } -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); } static int __sb_tc_pool_bind_get_dumpit(struct sk_buff *msg,
net/ieee802154/ieee802154.h +2 -1
@@ -40,7 +40,8 @@ struct sk_buff *ieee802154_nl_create(int flags, u8 req);int ieee802154_nl_mcast (struct sk_buff *msg,unsigned int group);struct sk_buff *ieee802154_nl_new_reply (struct genl_info *info,int flags,u8 req); -int ieee802154_nl_reply (struct sk_buff *msg,struct genl_info *info); +int ieee802154_nl_reply (struct sk_buff *msg,struct genl_info *info, +gfp_t flags);extern struct genl_family nl802154_family;
net/ieee802154/netlink.c +3 -2
@@ -87,14 +87,15 @@ struct sk_buff *ieee802154_nl_new_reply(struct genl_info *info,return msg; } -int ieee802154_nl_reply (struct sk_buff *msg,struct genl_info *info) +int ieee802154_nl_reply (struct sk_buff *msg,struct genl_info *info, +gfp_t flags) {struct nlmsghdr *nlh =nlmsg_hdr (msg);void *hdr =genlmsg_data (nlmsg_data (nlh));genlmsg_end (msg, hdr); -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info, flags); }static const struct genl_ops ieee8021154_ops[] = {
net/ieee802154/nl-mac.c +2 -2
@@ -435,7 +435,7 @@ int ieee802154_list_iface(struct sk_buff *skb, struct genl_info *info)dev_put (dev); -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); out_free:nlmsg_free (msg); out_dev:
@@ -692,7 +692,7 @@ int ieee802154_llsec_getparams(struct sk_buff *skb, struct genl_info *info)dev_put (dev); -return ieee802154_nl_reply (msg, info); +return ieee802154_nl_reply (msg, info,GFP_KERNEL ); out_free:nlmsg_free (msg); out_dev:
net/ieee802154/nl-phy.c +3 -3
@@ -110,7 +110,7 @@ int ieee802154_list_phy(struct sk_buff *skb, struct genl_info *info)wpan_phy_put (phy); -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); out_free:nlmsg_free (msg); out_dev:
@@ -255,7 +255,7 @@ int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info)wpan_phy_put (phy); -return ieee802154_nl_reply (msg, info); +return ieee802154_nl_reply (msg, info,GFP_ATOMIC ); dev_unregister:rtnl_lock ();/* del_iface must be called with RTNL lock */
@@ -336,7 +336,7 @@ int ieee802154_del_iface(struct sk_buff *skb, struct genl_info *info) goto nla_put_failure;wpan_phy_put (phy); -return ieee802154_nl_reply (msg, info); +return ieee802154_nl_reply (msg, info,GFP_ATOMIC ); nla_put_failure:nlmsg_free (msg);
net/ieee802154/nl802154.c +2 -2
@@ -681,7 +681,7 @@ static int nl802154_get_wpan_phy(struct sk_buff *skb, struct genl_info *info)return -ENOBUFS ; } -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); }static inline u64 wpan_dev_id (struct wpan_dev *wpan_dev)
@@ -918,7 +918,7 @@ static int nl802154_get_interface(struct sk_buff *skb, struct genl_info *info)return -ENOBUFS ; } -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); }static int nl802154_new_interface (struct sk_buff *skb,struct genl_info *info)
net/ipv4/fou.c +1 -1
@@ -780,7 +780,7 @@ static int fou_nl_cmd_get_port(struct sk_buff *skb, struct genl_info *info)if (ret <0 ) goto out_free; -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); out_free:nlmsg_free (msg);
net/ipv4/tcp_metrics.c +1 -1
@@ -1024,7 +1024,7 @@ static int tcp_metrics_nl_cmd_get(struct sk_buff *skb, struct genl_info *info) goto out_free;genlmsg_end (msg, reply); -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); nla_put_failure: ret = -EMSGSIZE ;
net/ipv6/ila/ila_xlat.c +1 -1
@@ -467,7 +467,7 @@ static int ila_nl_cmd_get_mapping(struct sk_buff *skb, struct genl_info *info)if (ret <0 ) goto out_free; -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); out_free:nlmsg_free (msg);
net/irda/irnetlink.c +1 -1
@@ -116,7 +116,7 @@ static int irda_nl_get_mode(struct sk_buff *skb, struct genl_info *info)genlmsg_end (msg, hdr); -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); err_out:nlmsg_free (msg);
net/netfilter/ipvs/ip_vs_ctl.c +1 -1
@@ -3760,7 +3760,7 @@ static int ip_vs_genl_get_cmd(struct sk_buff *skb, struct genl_info *info) }genlmsg_end (msg, reply); - ret =genlmsg_reply (msg, info); + ret =genlmsg_reply (msg, info,GFP_KERNEL ); goto out; nla_put_failure:
net/netlabel/netlabel_cipso_v4.c +1 -1
@@ -590,7 +590,7 @@ list_start:rcu_read_unlock ();genlmsg_end (ans_skb, data); -return genlmsg_reply (ans_skb, info); +return genlmsg_reply (ans_skb, info,GFP_KERNEL ); list_retry:/* XXX - this limit is a guesstimate */
net/netlabel/netlabel_mgmt.c +2 -2
@@ -577,7 +577,7 @@ static int netlbl_mgmt_listdef(struct sk_buff *skb, struct genl_info *info) goto listdef_failure;genlmsg_end (ans_skb, data); -return genlmsg_reply (ans_skb, info); +return genlmsg_reply (ans_skb, info,GFP_KERNEL ); listdef_failure_lock:rcu_read_unlock ();
@@ -688,7 +688,7 @@ static int netlbl_mgmt_version(struct sk_buff *skb, struct genl_info *info) goto version_failure;genlmsg_end (ans_skb, data); -return genlmsg_reply (ans_skb, info); +return genlmsg_reply (ans_skb, info,GFP_KERNEL ); version_failure:kfree_skb (ans_skb);
net/netlabel/netlabel_unlabeled.c +1 -1
@@ -874,7 +874,7 @@ static int netlbl_unlabel_list(struct sk_buff *skb, struct genl_info *info) goto list_failure;genlmsg_end (ans_skb, data); -return genlmsg_reply (ans_skb, info); +return genlmsg_reply (ans_skb, info,GFP_KERNEL ); list_failure:kfree_skb (ans_skb);
net/netlink/af_netlink.c +1 -1
@@ -1227,7 +1227,7 @@ int netlink_unicast(struct sock *ssk, struct sk_buff *skb, u32 portid,int err;long timeo; - skb =netlink_trim (skb, allocation ? allocation :gfp_any ()); + skb =netlink_trim (skb, allocation); timeo =sock_sndtimeo (ssk, nonblock); retry:
net/netlink/genetlink.c +1 -1
@@ -933,7 +933,7 @@ static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info)if (IS_ERR (msg))return PTR_ERR (msg); -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); } static int genl_ctrl_event(int event, struct genl_family *family,
net/nfc/netlink.c +3 -3
@@ -772,7 +772,7 @@ static int nfc_genl_get_device(struct sk_buff *skb, struct genl_info *info)nfc_put_device (dev); -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); out_free:nlmsg_free (msg);
@@ -1056,7 +1056,7 @@ exit:return rc; } -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); }static int nfc_genl_llc_set_params (struct sk_buff *skb,struct genl_info *info)
@@ -1653,7 +1653,7 @@ int nfc_vendor_cmd_reply(struct sk_buff *skb) }genlmsg_end (skb, hdr); -return genlmsg_reply (skb, dev->cur_cmd_info); +return genlmsg_reply (skb, dev->cur_cmd_info,gfp_any ()); }EXPORT_SYMBOL (nfc_vendor_cmd_reply);
net/openvswitch/datapath.c +3 -3
@@ -1274,7 +1274,7 @@ static int ovs_flow_cmd_get(struct sk_buff *skb, struct genl_info *info) }ovs_unlock (); -return genlmsg_reply (reply, info); +return genlmsg_reply (reply, info,GFP_KERNEL ); unlock:ovs_unlock ();return err;
@@ -1760,7 +1760,7 @@ static int ovs_dp_cmd_get(struct sk_buff *skb, struct genl_info *info)BUG_ON (err <0 );ovs_unlock (); -return genlmsg_reply (reply, info); +return genlmsg_reply (reply, info,GFP_KERNEL ); err_unlock_free:ovs_unlock ();
@@ -2163,7 +2163,7 @@ static int ovs_vport_cmd_get(struct sk_buff *skb, struct genl_info *info)BUG_ON (err <0 );rcu_read_unlock (); -return genlmsg_reply (reply, info); +return genlmsg_reply (reply, info,GFP_KERNEL ); exit_unlock_free:rcu_read_unlock ();
net/tipc/bearer.c +2 -2
@@ -763,7 +763,7 @@ int tipc_nl_bearer_get(struct sk_buff *skb, struct genl_info *info) goto err_out;rtnl_unlock (); -return genlmsg_reply (rep, info); +return genlmsg_reply (rep, info,GFP_KERNEL ); err_out:rtnl_unlock ();nlmsg_free (rep);
@@ -1022,7 +1022,7 @@ int tipc_nl_media_get(struct sk_buff *skb, struct genl_info *info) goto err_out;rtnl_unlock (); -return genlmsg_reply (rep, info); +return genlmsg_reply (rep, info,GFP_KERNEL ); err_out:rtnl_unlock ();nlmsg_free (rep);
net/tipc/node.c +1 -1
@@ -1774,7 +1774,7 @@ int tipc_nl_node_get_link(struct sk_buff *skb, struct genl_info *info) } } -return genlmsg_reply (msg.skb, info); +return genlmsg_reply (msg.skb, info,GFP_KERNEL ); }int tipc_nl_node_reset_link_stats (struct sk_buff *skb,struct genl_info *info)
net/wireless/nl80211.c +17 -17
@@ -1948,7 +1948,7 @@ static int nl80211_get_wiphy(struct sk_buff *skb, struct genl_info *info)return -ENOBUFS ; } -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); }static const struct nla_policy txq_params_policy[NL80211_TXQ_ATTR_MAX +1 ] = {
@@ -2574,7 +2574,7 @@ static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info)return -ENOBUFS ; } -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); }static const struct nla_policy mntr_flags_policy[NL80211_MNTR_FLAG_MAX +1 ] = {
@@ -2833,7 +2833,7 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) } out: -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); }static int nl80211_del_interface (struct sk_buff *skb,struct genl_info *info)
@@ -3007,7 +3007,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info) goto nla_put_failure;genlmsg_end (msg, hdr); -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); nla_put_failure: err = -ENOBUFS ;
@@ -4050,7 +4050,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info)return -ENOBUFS ; } -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); } int cfg80211_check_station_change(struct wiphy *wiphy,
@@ -4852,7 +4852,7 @@ static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info)return -ENOBUFS ; } -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); }static int nl80211_set_mpath (struct sk_buff *skb,struct genl_info *info)
@@ -4957,7 +4957,7 @@ static int nl80211_get_mpp(struct sk_buff *skb, struct genl_info *info)return -ENOBUFS ; } -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); } static int nl80211_dump_mpp(struct sk_buff *skb,
@@ -5234,7 +5234,7 @@ static int nl80211_get_mesh_config(struct sk_buff *skb, goto nla_put_failure;nla_nest_end (msg, pinfoattr);genlmsg_end (msg, hdr); -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); nla_put_failure:genlmsg_cancel (msg, hdr);
@@ -5672,7 +5672,7 @@ static int nl80211_get_reg_do(struct sk_buff *skb, struct genl_info *info)rcu_read_unlock ();genlmsg_end (msg, hdr); -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); nla_put_failure_rcu:rcu_read_unlock ();
@@ -8485,7 +8485,7 @@ static int nl80211_remain_on_channel(struct sk_buff *skb,genlmsg_end (msg, hdr); -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); nla_put_failure: err = -ENOBUFS ;
@@ -8897,7 +8897,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) goto nla_put_failure;genlmsg_end (msg, hdr); -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); }return 0 ;
@@ -9007,7 +9007,7 @@ static int nl80211_get_power_save(struct sk_buff *skb, struct genl_info *info) goto nla_put_failure;genlmsg_end (msg, hdr); -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); nla_put_failure: err = -ENOBUFS ;
@@ -9428,7 +9428,7 @@ static int nl80211_get_wowlan(struct sk_buff *skb, struct genl_info *info) }genlmsg_end (msg, hdr); -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); nla_put_failure:nlmsg_free (msg);
@@ -9892,7 +9892,7 @@ static int nl80211_get_coalesce(struct sk_buff *skb, struct genl_info *info) goto nla_put_failure;genlmsg_end (msg, hdr); -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); nla_put_failure:nlmsg_free (msg);
@@ -10185,7 +10185,7 @@ static int nl80211_probe_client(struct sk_buff *skb,genlmsg_end (msg, hdr); -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); nla_put_failure: err = -ENOBUFS ;
@@ -10292,7 +10292,7 @@ static int nl80211_get_protocol_features(struct sk_buff *skb, goto nla_put_failure;genlmsg_end (msg, hdr); -return genlmsg_reply (msg, info); +return genlmsg_reply (msg, info,GFP_KERNEL ); nla_put_failure:kfree_skb (msg);
@@ -10672,7 +10672,7 @@ int cfg80211_vendor_cmd_reply(struct sk_buff *skb)nla_nest_end (skb, data);genlmsg_end (skb, hdr); -return genlmsg_reply (skb, rdev->cur_cmd_info); +return genlmsg_reply (skb, rdev->cur_cmd_info,gfp_any ()); }EXPORT_SYMBOL_GPL (cfg80211_vendor_cmd_reply);
Signature · 1 line
2.7.4
From: Masashi Honma <[email protected]>
Date: Wed, 6 Jul 2016 09:28:29 +0900
Quoted 2 lines
Though currently such a use case was not found, to solve potential issue we will add an allocation flag to
netlink_unicast().
We don't solve potential issues, we solve real issues.
There is no reason to add the GFP parameter until it is actually needed.
At the fs/dlm/netlink.c#dlm_timeout_warn(),prepare_data allocates buffer with GFP_NOFS
and send_data() sends the buffer.
But send_data() uses GFP_KERNEL or GFP_ATOMIC inside it. Should it be replaced by GFP_NOFS ?
Masashi Honma
Re: [RFC 5/7] net: Add allocation flag to rtnl_unicast()
In reply to Masashi HonmaQuoted 18 lines · Masashi Honma
Signed-off-by Masashi Honma <[email protected]>---
net/ipv6/addrconf.c +1
-1@@ -628,7 +628,7 @@ static int inet6_netconf_get_devconf(struct sk_buff *in_skb,kfree_skb (skb); goto errout; } - err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid); + err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid,GFP_ATOMIC ); errout:return err; }
net/ipv6/addrconf.c static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr *nlh) · line 4830
Quoted 8 lines
net/ipv6/addrconf.c +1
-1@@ -4824,7 +4824,7 @@ static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr *nlh)kfree_skb (skb); goto errout_ifa; } - err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid); + err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid,GFP_KERNEL ); errout_ifa:in6_ifa_put (ifa); errout:
Managing to mix GFP_ATOMIC and GFP_KERNEL almost randomly as you did in this patch is definitely not good.
Further more, RTNL is a mutex, held in control path, designed to allow schedules and waiting for memory under pressure.
We do not want to encourage GFP_ATOMIC usage in control path.
Your patch series gives the wrong signal to developers.
I will send a patch against net/ipv4/devinet.c so that we remove GFP_ATOMIC usage there.
Re: [RFC 5/7] net: Add allocation flag to rtnl_unicast()
Quoted 4 lines · Eric Dumazet
Managing to mix
GFP_ATOMICandGFP_KERNELalmost randomly as you did in this patch is definitely not good.
Quoted 9 lines
Further more, RTNL is a mutex, held in control path, designed to allow schedules and waiting for memory under pressure.
We do not want to encourage
GFP_ATOMICusage in control path.Your patch series gives the wrong signal to developers.
Thanks for comment.
I have selected GFP flags based on existing code.
I have selected GFP_ATOMIC in inet6_netconf_get_devconf() because skb was allocated with GFP_ATOMIC.
I have used GFP_KERNEL in inet6_rtm_getaddr() by same reason.
Quoted 2 lines
I will send a patch against
net/ipv4/devinet.cso that we removeGFP_ATOMICusage there.
Thanks. I will modify my patch based on your new code.
PATCH 1/1 ipv4: do not abuse GFP_ATOMIC in inet_netconf_notify_devconf()
In reply to Eric DumazetFrom: Eric Dumazet <[email protected]>
inet_forward_change() runs with RTNL held.
We are allowed to sleep if required.
If we use __in_dev_get_rtnl() instead of __in_dev_get_rcu(), we no longer have to use GFP_ATOMIC allocations in inet_netconf_notify_devconf(), meaning we are less likely to miss notifications under memory pressure, and wont touch precious memory reserves either and risk dropping incoming packets.
inet_netconf_get_devconf() can also use GFP_KERNEL allocation.
--- net/ipv4/devinet.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
net/ipv4/devinet.c +6 -6
@@ -1834,7 +1834,7 @@ void inet_netconf_notify_devconf(struct net *net, int type, int ifindex,struct sk_buff *skb;int err = -ENOBUFS ; - skb =nlmsg_new (inet_netconf_msgsize_devconf (type),GFP_ATOMIC ); + skb =nlmsg_new (inet_netconf_msgsize_devconf (type),GFP_KERNEL );if (!skb) goto errout;
@@ -1846,7 +1846,7 @@ void inet_netconf_notify_devconf(struct net *net, int type, int ifindex,kfree_skb (skb); goto errout; } -rtnl_notify (skb, net,0 ,RTNLGRP_IPV4_NETCONF ,NULL ,GFP_ATOMIC ); +rtnl_notify (skb, net,0 ,RTNLGRP_IPV4_NETCONF ,NULL ,GFP_KERNEL );return ; errout:if (err <0 )
@@ -1903,7 +1903,7 @@ static int inet_netconf_get_devconf(struct sk_buff *in_skb, } err = -ENOBUFS ; - skb =nlmsg_new (inet_netconf_msgsize_devconf (NETCONFA_ALL ),GFP_ATOMIC ); + skb =nlmsg_new (inet_netconf_msgsize_devconf (NETCONFA_ALL ),GFP_KERNEL );if (!skb) goto errout;
@@ -2027,16 +2027,16 @@ static void inet_forward_change(struct net *net)for_each_netdev (net, dev) {struct in_device *in_dev; +if (on)dev_disable_lro (dev); -rcu_read_lock (); - in_dev =__in_dev_get_rcu (dev); + + in_dev =__in_dev_get_rtnl (dev);if (in_dev) {IN_DEV_CONF_SET (in_dev,FORWARDING , on);inet_netconf_notify_devconf (net,NETCONFA_FORWARDING , dev->ifindex, &in_dev->cnf); } -rcu_read_unlock (); } }
PATCH 1/1 ipv6: do not abuse GFP_ATOMIC in inet6_netconf_notify_devconf()
From: Eric Dumazet <[email protected]>
All inet6_netconf_notify_devconf() callers are in process context, so we can use GFP_KERNEL allocations if we take care of not holding a rwlock while not needed in ip6mr (we hold RTNL there)
--- net/ipv6/addrconf.c | 4 ++-- net/ipv6/ip6mr.c | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-)
net/ipv6/addrconf.c +2 -2
@@ -547,7 +547,7 @@ void inet6_netconf_notify_devconf(struct net *net, int type, int ifindex,struct sk_buff *skb;int err = -ENOBUFS ; - skb =nlmsg_new (inet6_netconf_msgsize_devconf (type),GFP_ATOMIC ); + skb =nlmsg_new (inet6_netconf_msgsize_devconf (type),GFP_KERNEL );if (!skb) goto errout;
@@ -559,7 +559,7 @@ void inet6_netconf_notify_devconf(struct net *net, int type, int ifindex,kfree_skb (skb); goto errout; } -rtnl_notify (skb, net,0 ,RTNLGRP_IPV6_NETCONF ,NULL ,GFP_ATOMIC ); +rtnl_notify (skb, net,0 ,RTNLGRP_IPV6_NETCONF ,NULL ,GFP_KERNEL );return ; errout:rtnl_set_sk_err (net,RTNLGRP_IPV6_NETCONF , err);
net/ipv6/ip6mr.c +7 -6
@@ -1592,14 +1592,15 @@ static int ip6mr_sk_init(struct mr6_table *mrt, struct sock *sk)if (likely (mrt->mroute6_sk ==NULL )) { mrt->mroute6_sk = sk; net->ipv6.devconf_all->mc_forwarding++; -inet6_netconf_notify_devconf (net,NETCONFA_MC_FORWARDING , -NETCONFA_IFINDEX_ALL , - net->ipv6.devconf_all); - } -else + }else { err = -EADDRINUSE ; + }write_unlock_bh (&mrt_lock); +if (!err) +inet6_netconf_notify_devconf (net,NETCONFA_MC_FORWARDING , +NETCONFA_IFINDEX_ALL , + net->ipv6.devconf_all);rtnl_unlock ();return err;
@@ -1617,11 +1618,11 @@ int ip6mr_sk_done(struct sock *sk)write_lock_bh (&mrt_lock); mrt->mroute6_sk =NULL ; net->ipv6.devconf_all->mc_forwarding--; +write_unlock_bh (&mrt_lock);inet6_netconf_notify_devconf (net,NETCONFA_MC_FORWARDING ,NETCONFA_IFINDEX_ALL , net->ipv6.devconf_all); -write_unlock_bh (&mrt_lock);mroute_clean_tables (mrt, false); err =0 ;
Re: [RFC 5/7] net: Add allocation flag to rtnl_unicast()
In reply to a message not in the archiveOn Fri, 2016-07-08 at 12:15 +0900, Masashi Honma wrote:
=
Quoted 6 lines
Thanks for comment.
I have selected GFP flags based on existing code.
I have selected
GFP_ATOMICininet6_netconf_get_devconf()because skb was allocated withGFP_ATOMIC.
Point is : we should remove GFP_ATOMIC uses as much as we can.
Everytime we see one of them, we should think why it was added and if this is really needed.
inet6_netconf_get_devconf() is a perfect example of one careless GFP_ATOMIC usage
Re: [PATCH net-next] ipv4: do not abuse GFP_ATOMIC in inet_netconf_notify_devconf()
In reply to Eric DumazetQuoted 11 lines · Eric Dumazet
From: Eric Dumazet <[email protected]>
inet_forward_change()runs with RTNL held.
We are allowed to sleep if required.If we use
__in_dev_get_rtnl()instead of__in_dev_get_rcu(), we no longer have to useGFP_ATOMICallocations ininet_netconf_notify_devconf(), meaning we are less likely to miss notifications under memory pressure, and wont touch precious memory reserves either and risk dropping incoming packets.
Quoted 6 lines
inet_netconf_get_devconf()can also useGFP_KERNELallocation.Fixes edc9e748934c ("rtnl/ipv4: use netconf msg to advertise forwarding status")Fixes 9e5511106f99 ("rtnl/ipv4: add support of RTM_GETNETCONF")Signed-off-by Eric Dumazet <[email protected]>Cc Nicolas Dichtel <[email protected]>
Nice catch, thank you!
Re: [PATCH net-next] ipv6: do not abuse GFP_ATOMIC in inet6_netconf_notify_devconf()
In reply to Eric DumazetQuoted 11 lines · Eric Dumazet
From: Eric Dumazet <[email protected]>
All
inet6_netconf_notify_devconf()callers are in process context, so we can useGFP_KERNELallocations if we take care of not holding a rwlock while not needed in ip6mr (we hold RTNL there)Fixes d67b8c616b48 ("netconf: advertise mc_forwarding status")Fixes f3a1bfb11ccb ("rtnl/ipv6: use netconf msg to advertise forwarding status")Signed-off-by Eric Dumazet <[email protected]>Cc Nicolas Dichtel <[email protected]>
Also nice, thanks.
Quoted 9 lines · David Teigland
Quoted 6 lines · Masashi Honma
At the fs/dlm/netlink.c#dlm_timeout_warn(),
prepare_dataallocates buffer withGFP_NOFS
andsend_data()sends the buffer.But
send_data()usesGFP_KERNELorGFP_ATOMICinside it. Should it be replaced byGFP_NOFS?That's old code that's never been used so it doesn't really matter.
I see. Thank you.
Quoted 1 line · Masashi Honma
Though
netlink_broadcast()...
Thanks for reply of David Miller, Eric Dumazet, David Teigrand.
On the basis of their comment, only rtnl_unicast() looks need to add gfp flag
argument. So I will drop almost of patches except 0005.
I will send patch v2 to more limited destination.
PATCH v2 1/1 rtnl: Add GFP flag argument to rtnl_unicast()
In reply to Masashi HonmaThis commit extends rtnl_unicast() to specify GFP flags.
This commit depends on Eric Dumazet's commits below.
ipv4: do not abuse GFP_ATOMIC in inet_netconf_notify_devconf()
ipv6: do not abuse GFP_ATOMIC in inet6_netconf_notify_devconf()
--- include/linux/netlink.h | 2 ++ include/linux/rtnetlink.h | 3 ++- net/core/net_namespace.c | 2 +- net/core/rtnetlink.c | 16 +++++++++++----- net/dcb/dcbnl.c | 2 +- net/decnet/dn_route.c | 3 ++- net/ipv4/devinet.c | 2 +- net/ipv4/ipmr.c | 6 ++++-- net/ipv4/route.c | 2 +- net/ipv6/addrconf.c | 4 ++-- net/ipv6/addrlabel.c | 2 +- net/ipv6/ip6mr.c | 6 ++++-- net/ipv6/route.c | 2 +- net/netlink/af_netlink.c | 12 +++++++++--- net/sched/act_api.c | 2 +- 15 files changed, 43 insertions(+), 23 deletions(-)
include/linux/netlink.h +2 -0
@@ -69,6 +69,8 @@ extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group)extern void netlink_ack (struct sk_buff *in_skb,struct nlmsghdr *nlh,int err);extern int netlink_has_listeners (struct sock *sk,unsigned int group); +extern int __netlink_unicast (struct sock *ssk,struct sk_buff *skb,u32 portid, +int nonblock,gfp_t allocation);extern int netlink_unicast (struct sock *ssk,struct sk_buff *skb,__u32 portid,int nonblock);extern int netlink_broadcast (struct sock *ssk,struct sk_buff *skb,__u32 portid,__u32 group,gfp_t allocation);
include/linux/rtnetlink.h +2 -1
@@ -8,7 +8,8 @@#include <uapi/linux/rtnetlink.h> extern int rtnetlink_send (struct sk_buff *skb,struct net *net,u32 pid,u32 group,int echo); -extern int rtnl_unicast (struct sk_buff *skb,struct net *net,u32 pid); +extern int rtnl_unicast (struct sk_buff *skb,struct net *net,u32 pid, +gfp_t flags);extern void rtnl_notify (struct sk_buff *skb,struct net *net,u32 pid,u32 group,struct nlmsghdr *nlh,gfp_t flags);extern void rtnl_set_sk_err (struct net *net,u32 group,int error);
net/core/net_namespace.c +1 -1
@@ -646,7 +646,7 @@ static int rtnl_net_getid(struct sk_buff *skb, struct nlmsghdr *nlh)if (err <0 ) goto err_out; - err =rtnl_unicast (msg, net,NETLINK_CB (skb).portid); + err =rtnl_unicast (msg, net,NETLINK_CB (skb).portid,GFP_KERNEL ); goto out; err_out:
net/core/rtnetlink.c +11 -5
@@ -653,11 +653,15 @@ int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int greturn err; } -int rtnl_unicast (struct sk_buff *skb,struct net *net,u32 pid) +int rtnl_unicast (struct sk_buff *skb,struct net *net,u32 pid,gfp_t flags) { -struct sock *rtnl = net->rtnl; +int err; -return nlmsg_unicast (rtnl, skb, pid); + err =__netlink_unicast (net->rtnl, skb, pid,MSG_DONTWAIT , flags); +if (err >0 ) + err =0 ; + +return err; }EXPORT_SYMBOL (rtnl_unicast);
@@ -2565,7 +2569,8 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh)WARN_ON (err == -EMSGSIZE );kfree_skb (nskb); }else - err =rtnl_unicast (nskb, net,NETLINK_CB (skb).portid); + err =rtnl_unicast (nskb, net,NETLINK_CB (skb).portid, +GFP_KERNEL );return err; }
@@ -3601,7 +3606,8 @@ static int rtnl_stats_get(struct sk_buff *skb, struct nlmsghdr *nlh)WARN_ON (err == -EMSGSIZE );kfree_skb (nskb); }else { - err =rtnl_unicast (nskb, net,NETLINK_CB (skb).portid); + err =rtnl_unicast (nskb, net,NETLINK_CB (skb).portid, +GFP_KERNEL ); }return err;
net/dcb/dcbnl.c +1 -1
@@ -1749,7 +1749,7 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh)nlmsg_end (reply_skb, reply_nlh); - ret =rtnl_unicast (reply_skb, net, portid); + ret =rtnl_unicast (reply_skb, net, portid,GFP_KERNEL ); out:return ret; }
net/decnet/dn_route.c +2 -1
@@ -1714,7 +1714,8 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh) goto out_free; } -return rtnl_unicast (skb, &init_net,NETLINK_CB (in_skb).portid); +return rtnl_unicast (skb, &init_net,NETLINK_CB (in_skb).portid, +GFP_KERNEL ); out_free:kfree_skb (skb);
net/ipv4/devinet.c +1 -1
@@ -1917,7 +1917,7 @@ static int inet_netconf_get_devconf(struct sk_buff *in_skb,kfree_skb (skb); goto errout; } - err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid); + err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid,GFP_KERNEL ); errout:return err; }
net/ipv4/ipmr.c +4 -2
@@ -654,7 +654,8 @@ static void ipmr_destroy_unres(struct mr_table *mrt, struct mfc_cache *c) e->error = -ETIMEDOUT ;memset (&e->msg,0 ,sizeof (e->msg)); -rtnl_unicast (skb, net,NETLINK_CB (skb).portid); +rtnl_unicast (skb, net,NETLINK_CB (skb).portid, +gfp_any ()); }else {kfree_skb (skb); }
@@ -933,7 +934,8 @@ static void ipmr_cache_resolve(struct net *net, struct mr_table *mrt,memset (&e->msg,0 ,sizeof (e->msg)); } -rtnl_unicast (skb, net,NETLINK_CB (skb).portid); +rtnl_unicast (skb, net,NETLINK_CB (skb).portid, +gfp_any ()); }else {ip_mr_forward (net, mrt, skb, c,0 ); }
net/ipv4/route.c +1 -1
@@ -2621,7 +2621,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh)if (err <0 ) goto errout_free; - err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid); + err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid,GFP_KERNEL ); errout:return err;
net/ipv6/addrconf.c +2 -2
@@ -628,7 +628,7 @@ static int inet6_netconf_get_devconf(struct sk_buff *in_skb,kfree_skb (skb); goto errout; } - err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid); + err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid,GFP_KERNEL ); errout:return err; }
@@ -4824,7 +4824,7 @@ static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr *nlh)kfree_skb (skb); goto errout_ifa; } - err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid); + err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid,GFP_KERNEL ); errout_ifa:in6_ifa_put (ifa); errout:
net/ipv6/addrlabel.c +1 -1
@@ -580,7 +580,7 @@ static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr *nlh) goto out; } - err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid); + err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid,GFP_KERNEL ); out:return err; }
net/ipv6/ip6mr.c +4 -2
@@ -850,7 +850,8 @@ static void ip6mr_destroy_unres(struct mr6_table *mrt, struct mfc6_cache *c) nlh->nlmsg_len =nlmsg_msg_size (sizeof (struct nlmsgerr ));skb_trim (skb, nlh->nlmsg_len); ((struct nlmsgerr *)nlmsg_data (nlh))->error = -ETIMEDOUT ; -rtnl_unicast (skb, net,NETLINK_CB (skb).portid); +rtnl_unicast (skb, net,NETLINK_CB (skb).portid, +gfp_any ()); }else kfree_skb (skb); }
@@ -1114,7 +1115,8 @@ static void ip6mr_cache_resolve(struct net *net, struct mr6_table *mrt,skb_trim (skb, nlh->nlmsg_len); ((struct nlmsgerr *)nlmsg_data (nlh))->error = -EMSGSIZE ; } -rtnl_unicast (skb, net,NETLINK_CB (skb).portid); +rtnl_unicast (skb, net,NETLINK_CB (skb).portid, +gfp_any ()); }else ip6_mr_forward (net, mrt, skb, c); }
net/ipv6/route.c +1 -1
@@ -3367,7 +3367,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh) goto errout; } - err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid); + err =rtnl_unicast (skb, net,NETLINK_CB (in_skb).portid,GFP_KERNEL ); errout:return err; }
net/netlink/af_netlink.c +9 -3
@@ -1220,14 +1220,14 @@ static int netlink_unicast_kernel(struct sock *sk, struct sk_buff *skb,return ret; } -int netlink_unicast (struct sock *ssk,struct sk_buff *skb, -u32 portid,int nonblock) +int __netlink_unicast (struct sock *ssk,struct sk_buff *skb,u32 portid, +int nonblock,gfp_t allocation) {struct sock *sk;int err;long timeo; - skb =netlink_trim (skb,gfp_any ()); + skb =netlink_trim (skb, allocation); timeo =sock_sndtimeo (ssk, nonblock); retry:
@@ -1254,6 +1254,12 @@ retry:return netlink_sendskb (sk, skb); } + +int netlink_unicast (struct sock *ssk,struct sk_buff *skb, +u32 portid,int nonblock) +{ +return __netlink_unicast (ssk, skb, portid, nonblock,gfp_any ()); +}EXPORT_SYMBOL (netlink_unicast);int netlink_has_listeners (struct sock *sk,unsigned int group)
net/sched/act_api.c +1 -1
@@ -737,7 +737,7 @@ act_get_notify(struct net *net, u32 portid, struct nlmsghdr *n,return -EINVAL ; } -return rtnl_unicast (skb, net, portid); +return rtnl_unicast (skb, net, portid,GFP_KERNEL ); }static struct tc_action *create_a (int i)
Signature · 1 line
2.7.4
Re: [PATCH net-next] ipv4: do not abuse GFP_ATOMIC in inet_netconf_notify_devconf()
In reply to Eric DumazetFrom: Eric Dumazet <[email protected]>
Date: Fri, 08 Jul 2016 05:18:24 +0200
Quoted 11 lines
From: Eric Dumazet <[email protected]>
inet_forward_change()runs with RTNL held.
We are allowed to sleep if required.If we use
__in_dev_get_rtnl()instead of__in_dev_get_rcu(), we no longer have to useGFP_ATOMICallocations ininet_netconf_notify_devconf(), meaning we are less likely to miss notifications under memory pressure, and wont touch precious memory reserves either and risk dropping incoming packets.
Quoted 6 lines
inet_netconf_get_devconf()can also useGFP_KERNELallocation.Fixes edc9e748934c ("rtnl/ipv4: use netconf msg to advertise forwarding status")Fixes 9e5511106f99 ("rtnl/ipv4: add support of RTM_GETNETCONF")Signed-off-by Eric Dumazet <[email protected]>Cc Nicolas Dichtel <[email protected]>
Applied.
Re: [PATCH net-next] ipv6: do not abuse GFP_ATOMIC in inet6_netconf_notify_devconf()
In reply to Eric DumazetFrom: Eric Dumazet <[email protected]>
Date: Fri, 08 Jul 2016 05:46:04 +0200
Quoted 11 lines
From: Eric Dumazet <[email protected]>
All
inet6_netconf_notify_devconf()callers are in process context, so we can useGFP_KERNELallocations if we take care of not holding a rwlock while not needed in ip6mr (we hold RTNL there)Fixes d67b8c616b48 ("netconf: advertise mc_forwarding status")Fixes f3a1bfb11ccb ("rtnl/ipv6: use netconf msg to advertise forwarding status")Signed-off-by Eric Dumazet <[email protected]>Cc Nicolas Dichtel <[email protected]>
Applied.
David Miller
maintainerRe: [PATCH v2 net-next] rtnl: Add GFP flag argument to rtnl_unicast()
In reply to Masashi HonmaFrom: Masashi Honma <[email protected]>
Date: Sat, 9 Jul 2016 12:59:04 +0900
Quoted 7 lines
This commit extends
rtnl_unicast()to specify GFP flags.This commit depends on Eric Dumazet's commits below.
ipv4: do not abuseGFP_ATOMICininet_netconf_notify_devconf()
ipv6: do not abuseGFP_ATOMICininet6_netconf_notify_devconf()Signed-off-by Masashi Honma <[email protected]>
The code is correct and optimal as-is. There is no gain to your changes. gfp_any() will do the right thing.
In fact, your change makes the code more error prone because if any of these code paths get moved into an atomic context they will break unless somone remembers to also fix up the GFP flags.
Meanwhile with the existing use of gfp_any() it will work transparently in such a situation.
I'm not applying this.
Re: [PATCH v2 net-next] rtnl: Add GFP flag argument to rtnl_unicast()
Quoted 11 lines · David Miller
The code is correct and optimal as-is. There is no gain to your changes.
gfp_any()will do the right thing.In fact, your change makes the code more error prone because if any of these code paths get moved into an atomic context they will break unless somone remembers to also fix up the GFP flags.
Meanwhile with the existing use of
gfp_any()it will work transparently in such a situation.I'm not applying this.
I see. Thank you for reviewing.