summaryrefslogtreecommitdiffstats
path: root/net/netlink
diff options
context:
space:
mode:
authorYajun Deng <yajun.deng@linux.dev>2021-07-27 11:41:41 +0800
committerDavid S. Miller <davem@davemloft.net>2021-07-27 11:43:50 +0100
commitf9b282b36dfa9b6c6d6b3e8816cdf0e4defff482 (patch)
treee632e0202b77a212cf2b6a2d4ef9982647699ebc /net/netlink
parentb0e81817629a496854ff1799f6cbd89597db65fd (diff)
downloadlinux-f9b282b36dfa9b6c6d6b3e8816cdf0e4defff482.tar.gz
linux-f9b282b36dfa9b6c6d6b3e8816cdf0e4defff482.tar.bz2
linux-f9b282b36dfa9b6c6d6b3e8816cdf0e4defff482.zip
net: netlink: add the case when nlh is NULL
Add the case when nlh is NULL in nlmsg_report(), so that the caller doesn't need to deal with this case. Signed-off-by: Yajun Deng <yajun.deng@linux.dev> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink')
-rw-r--r--net/netlink/genetlink.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 2d6fdf40df66..ae58da608a31 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -1485,6 +1485,7 @@ int genlmsg_multicast_allns(const struct genl_family *family,
{
if (WARN_ON_ONCE(group >= family->n_mcgrps))
return -EINVAL;
+
group = family->mcgrp_offset + group;
return genlmsg_mcast(skb, portid, group, flags);
}
@@ -1495,14 +1496,12 @@ void genl_notify(const struct genl_family *family, struct sk_buff *skb,
{
struct net *net = genl_info_net(info);
struct sock *sk = net->genl_sock;
- int report = 0;
-
- if (info->nlhdr)
- report = nlmsg_report(info->nlhdr);
if (WARN_ON_ONCE(group >= family->n_mcgrps))
return;
+
group = family->mcgrp_offset + group;
- nlmsg_notify(sk, skb, info->snd_portid, group, report, flags);
+ nlmsg_notify(sk, skb, info->snd_portid, group,
+ nlmsg_report(info->nlhdr), flags);
}
EXPORT_SYMBOL(genl_notify);