From patchwork Sun Feb 21 20:58:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Couzens X-Patchwork-Id: 62460 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp893921lbl; Sun, 21 Feb 2016 13:29:11 -0800 (PST) X-Received: by 10.66.248.168 with SMTP id yn8mr33649808pac.24.1456090151107; Sun, 21 Feb 2016 13:29:11 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yv4si34502092pab.119.2016.02.21.13.29.10; Sun, 21 Feb 2016 13:29:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752087AbcBUV3D (ORCPT + 4 others); Sun, 21 Feb 2016 16:29:03 -0500 Received: from mail.base45.de ([80.241.61.77]:34899 "EHLO mail.base45.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751373AbcBUV3B (ORCPT ); Sun, 21 Feb 2016 16:29:01 -0500 X-Greylist: delayed 1781 seconds by postgrey-1.27 at vger.kernel.org; Sun, 21 Feb 2016 16:29:01 EST Received: from ip5b418436.dynamic.kabel-deutschland.de ([91.65.132.54] helo=lazus.yip) by mail.base45.de with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA256:128) (Exim 4.82) (envelope-from ) id 1aXb64-0008ME-Jb; Sun, 21 Feb 2016 21:59:16 +0100 From: Alexander Couzens To: netdev@vger.kernel.org Cc: Alexander Couzens Subject: [PATCH] l2tp_netlink: ignore -ESRCH of genlmsg_multicast_allns() Date: Sun, 21 Feb 2016 21:58:45 +0100 Message-Id: <1456088325-22375-1-git-send-email-lynxis@fe80.eu> X-Mailer: git-send-email 2.7.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- net/l2tp/l2tp_netlink.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) -- 2.7.1 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; }