@@ -123,11 +123,15 @@ static int l2tp_tunnel_notify(struct genl_family *family,
ret = l2tp_nl_tunnel_send(msg, info->snd_portid, info->snd_seq,
NLM_F_ACK, tunnel, cmd);
+ if (ret < 0) {
+ nlmsg_free(msg);
+ return ret;
+ }
- if (ret >= 0)
- return genlmsg_multicast_allns(family, msg, 0, 0, GFP_ATOMIC);
-
- nlmsg_free(msg);
+ ret = genlmsg_multicast_allns(family, msg, 0, 0, GFP_ATOMIC);
+ /* We don't care if no one is listening */
+ if (ret == -ESRCH)
+ ret = 0;
return ret;
}
@@ -146,11 +150,15 @@ static int l2tp_session_notify(struct genl_family *family,
ret = l2tp_nl_session_send(msg, info->snd_portid, info->snd_seq,
NLM_F_ACK, session, cmd);
+ if (ret < 0) {
+ nlmsg_free(msg);
+ return ret;
+ }
- if (ret >= 0)
- return genlmsg_multicast_allns(family, msg, 0, 0, GFP_ATOMIC);
-
- nlmsg_free(msg);
+ ret = genlmsg_multicast_allns(family, msg, 0, 0, GFP_ATOMIC);
+ /* We don't care if no one is listening */
+ if (ret == -ESRCH)
+ ret = 0;
return ret;
}
If no one registered to the l2tp netlink group, genlmsg_multicast_allns returns -ESRCH. Ignore return code -ESRCH of genlmsg_mulitcast_allns within tunnel_create and session_create calls. Signed-off-by: Alexander Couzens <lynxis@fe80.eu> --- net/l2tp/l2tp_netlink.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) -- 2.7.1