Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1245704pxb; Fri, 22 Jan 2021 10:26:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrKZobrzEm6OQecBxZnhlpXOTc+ezYdU0taqt6VKMbszAOL7x7Y1SjBGzssOdgKrf6qgqd X-Received: by 2002:a17:906:5857:: with SMTP id h23mr3641663ejs.465.1611340003686; Fri, 22 Jan 2021 10:26:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611340003; cv=none; d=google.com; s=arc-20160816; b=D82HZO7S8H7oSO9L4XEr7+tguXyC8bZvWWUduXfxdogvEfR8xCSFf0dUqg9MOAVEaU O9jipDF3fEtD2oeXEw+0uqsbXb5DCAS09N3CWfAkL0URsAeeufQdRViLV6+nwxzuVsoF mE+mEXUZ7TxIGvYsIVUjemJjKaIPv5jd7hdITkhMfD0VqjzUAbs+V/+UCJt/FbqBEsGH EDb64SsQC8c+zqu70G3xcpmsNPjdrqQEs/hW1jKwBG6Zc0RiaCzeOST3EckMvz41MwXT t53NmbdkB7oitzNUJ8yoxfUgvp7YdVbEqOClcntiGwI8FwTmvZ+CbQfK8PKLH6+xqh+B jLbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Vwkn9GwBIdCXGqhiPZ4z9+pjri6WJjZF3Isipl+NCa0=; b=tSgBmgDcgmRYQQZ8YWpNxmm/EXw2vwct4ISjO8findIZU2hyF1LoyjR2ZWKgNvF3LP cOYrlE136y8Elt1xfJG0L4zOPgFBZHfDU3o38UXu4JwOoqQNcjR5Jx5mHJviqT2K6Ovj YTPbTQcZQjm8kiD4veu/IfpJyi/AaOj6m6ebmOW9TGVXWJCYUS2zw1r/hloidwrO4d/q /nezarM23f8MJQmqbFmwrfn9xRzGa27udv2wZhOiTCubTieBH4zL+DL1DG3idXwdFrt9 Ri+GNqbzxQfil9+CkDJ4RMz9w+Krf5QRFdowd//yaBNT8BKauQIsoskjuwTNU00GtWmP Ztig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nCsyjBHM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o59si3941404edd.460.2021.01.22.10.26.20; Fri, 22 Jan 2021 10:26:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nCsyjBHM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729862AbhAVSZJ (ORCPT + 99 others); Fri, 22 Jan 2021 13:25:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:40034 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728577AbhAVOXB (ORCPT ); Fri, 22 Jan 2021 09:23:01 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3CF3423AFB; Fri, 22 Jan 2021 14:17:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611325038; bh=ruxU2as5IkGK2lYOHxRsD0L3W0vZl97aVKmldcNiG5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nCsyjBHMyKc+4TEI1Uei9Efa6LXe612vSHPAPE8dJTCELIv34v1WRHTwiU9i95Xh+ OmEh0QD5kbfymcr/eXKZvQxdRMFbIXeey65DSGCDLRJWcFzvvc9ghWICI7v5sIouXP CSXl8oWi89Zrc0q1BeU9ufrtHaefnX+9wkLjNqGI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Dichtel , Jakub Kicinski , syzbot+2393580080a2da190f04@syzkaller.appspotmail.com Subject: [PATCH 5.4 26/33] net: sit: unregister_netdevice on newlinks error path Date: Fri, 22 Jan 2021 15:12:42 +0100 Message-Id: <20210122135734.636947613@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135733.565501039@linuxfoundation.org> References: <20210122135733.565501039@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jakub Kicinski [ Upstream commit 47e4bb147a96f1c9b4e7691e7e994e53838bfff8 ] We need to unregister the netdevice if config failed. .ndo_uninit takes care of most of the heavy lifting. This was uncovered by recent commit c269a24ce057 ("net: make free_netdev() more lenient with unregistering devices"). Previously the partially-initialized device would be left in the system. Reported-and-tested-by: syzbot+2393580080a2da190f04@syzkaller.appspotmail.com Fixes: e2f1f072db8d ("sit: allow to configure 6rd tunnels via netlink") Acked-by: Nicolas Dichtel Link: https://lore.kernel.org/r/20210114012947.2515313-1-kuba@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv6/sit.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -1597,8 +1597,11 @@ static int ipip6_newlink(struct net *src } #ifdef CONFIG_IPV6_SIT_6RD - if (ipip6_netlink_6rd_parms(data, &ip6rd)) + if (ipip6_netlink_6rd_parms(data, &ip6rd)) { err = ipip6_tunnel_update_6rd(nt, &ip6rd); + if (err < 0) + unregister_netdevice_queue(dev, NULL); + } #endif return err;