diff mbox

l2tp_netlink: ignore -ESRCH of genlmsg_multicast_allns()

Message ID 1456088325-22375-1-git-send-email-lynxis@fe80.eu
State New
Headers show

Commit Message

Alexander Couzens Feb. 21, 2016, 8:58 p.m. UTC
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

Comments

Alexander Couzens Feb. 22, 2016, 1:41 p.m. UTC | #1
Sorry for the noise. I only looked into the git tree net-next for
changes of the l2tp module and not lately on the mailinglist.

Best,
lynxis
-- 
Alexander Couzens

mail: lynxis@fe80.eu
jabber: lynxis@fe80.eu
mobile: +4915123277221
gpg: 390D CF78 8BF9 AA50 4F8F  F1E2 C29E 9DA6 A0DF 8604
diff mbox

Patch

diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c
index f93c5be..eced13a 100644
--- a/net/l2tp/l2tp_netlink.c
+++ b/net/l2tp/l2tp_netlink.c
@@ -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;
 }