Received: by 10.213.65.68 with SMTP id h4csp1220562imn; Wed, 14 Mar 2018 13:17:46 -0700 (PDT) X-Google-Smtp-Source: AG47ELv/NADkPUW24TRfBNqBtJu4hOBYcy+RybGwWUtYTq2eB84g3G1rn1iIas3OJpnJs1edJexy X-Received: by 10.99.104.73 with SMTP id d70mr4721794pgc.107.1521058666430; Wed, 14 Mar 2018 13:17:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521058666; cv=none; d=google.com; s=arc-20160816; b=qXn5h1UT1GwmuDj0eSJEdmaONRjBQZRO4DzuHsGNNke5QXii76hX/dM9cMDo8wGQQs F66WCOrevxsXC2J9/Vhn1CvkmVz8T4NIj2IRblymZD6lhbAuhDIcFW/cRv8+wJ4gPHQr BGZVz4abIe7n91xVJI3HPjmT4eK3ISMUXZorwEbZ8ltO+/t+iu6w3m2XAfTCsL95FztM EC2OO6hNwh3ViL3XOE0WirwGy4u1LWUxEudXSsj9COvAIH/sv1YDKHAOhxCoCjdnQ09h rJbMGwTC+7SuOUKohyucnzM4ok2fZyhWzXRfgFnqJNKgD+EPwynvswj1mngGTiLrvjrV PHmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=dZgWyRb0+1CnBqDHGfEC6D2PAv3yJ83XqNzReYEnOy0=; b=gii1S6tqqkFQzHn36K3EPsXetgZzq+ls0DfS2DERTiwmLUXDlS0Z9fbMX4ZfDOqpAS yL1VAmZu4xBkBRbXNfnm6DQmOqssXQOUi5So6v0Kq4pJGYnx/MuCZUREherLYS5zGau1 MY2xnQqzFUqyHImX6p6CDuAQAuQE7dX2Eok7j9sLiDTJ1nwuR5lB7EdlYXCIoUoXaHj1 d7TrLS+9nQjLFSGmV2YYOi+k+JfEN6W/AKKoX8swjebQUxWLr4LcIza8P/3XePjM+fwz GIKWyvgW4d+jwXD+oEzDgZIiEdo96qzQzpiG11YTJ4uPZ2P4i95AyFfPa2Hef7oZLGW9 ylOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m1-v6si2418189pls.673.2018.03.14.13.17.29; Wed, 14 Mar 2018 13:17:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751666AbeCNUQ0 (ORCPT + 99 others); Wed, 14 Mar 2018 16:16:26 -0400 Received: from host.76.145.23.62.rev.coltfrance.com ([62.23.145.76]:54348 "EHLO proxy.6wind.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751170AbeCNUQY (ORCPT ); Wed, 14 Mar 2018 16:16:24 -0400 X-Greylist: delayed 313 seconds by postgrey-1.27 at vger.kernel.org; Wed, 14 Mar 2018 16:16:23 EDT Received: from bretzel.dev.6wind.com (unknown [10.16.0.19]) by proxy.6wind.com (Postfix) with ESMTPS id A29A71471FC; Wed, 14 Mar 2018 21:06:56 +0100 (CET) Received: from dichtel by bretzel.dev.6wind.com with local (Exim 4.89) (envelope-from ) id 1ewCjg-0007KT-78; Wed, 14 Mar 2018 21:10:56 +0100 From: Nicolas Dichtel To: ben.hutchings@codethink.co.uk Cc: davem@davemloft.net, netdev@vger.kernel.org, stable@vger.kernel.org, johannes.berg@intel.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, Nicolas Dichtel Subject: [PATCH net] netlink: avoid a double skb free in genlmsg_mcast() Date: Wed, 14 Mar 2018 21:10:23 +0100 Message-Id: <20180314201023.12407-1-nicolas.dichtel@6wind.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <1520899459.23626.87.camel@codethink.co.uk> References: <1520899459.23626.87.camel@codethink.co.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org nlmsg_multicast() consumes always the skb, thus the original skb must be freed only when this function is called with a clone. Fixes: cb9f7a9a5c96 ("netlink: ensure to loop over all netns in genlmsg_multicast_allns()") Reported-by: Ben Hutchings Signed-off-by: Nicolas Dichtel --- net/netlink/genetlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 6f02499ef007..b9ce82c9440f 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -1106,7 +1106,7 @@ static int genlmsg_mcast(struct sk_buff *skb, u32 portid, unsigned long group, if (!err) delivered = true; else if (err != -ESRCH) - goto error; + return err; return delivered ? 0 : -ESRCH; error: kfree_skb(skb); -- 2.15.1