Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4882664pjb; Mon, 27 Jul 2020 07:31:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxN0t99JJ5lHO3UIDntOz6QNSjIh/zv6aKwXP+og1rKr6CzR5ISAHKZdH1/TSX3xCB4sm2/ X-Received: by 2002:a05:6402:37b:: with SMTP id s27mr5430356edw.239.1595860298461; Mon, 27 Jul 2020 07:31:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595860298; cv=none; d=google.com; s=arc-20160816; b=klSq1P0nw2Keh9qEh98f4DHbUW72pqBUhkUnJ1B9HqmdLbXZNzyKoT6JgHEFogJGQV OJWlx5DB6dhE/I0A7PInpbbiMY4ccNxgDbG8SnCUFQcn94Qtl8dss91cAOKY8VQAj5eG pKCYgSblT2HClepXurUbN3/sLOTuFNbG/yhf7g1QdxufLLvNPJFMLGQQVK9g4FaaCf9T r82sDphz3rS3juFCQhq+la4anUjj1A2wA6PHw7k/Y/aN/Ng4y4LJZEcb0l276C4jtT4w a9RWg+73GRA9RXsz/Ml+R9naC6k5/Nc9iGq7JANojBQQ3icwwpy3RH6+mBp/U/V9DvlL i7OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FLmo0gS3HT1mXvULuW0MTpHpKxH022ma5HPCfk5+dxk=; b=RKaeV89Jvs6U+mPmyzY/i86hi/nDnKEo6Jy1xxJAsxpVs0Df1ZlZzg29l3AHZ1CabA 70b6+c+JJCkF+FzPSLXuQdoCJxzRaqGW4r5Z+zeIeQRzylrEkMq5NtT21Y+JKJbdX8Mh 2xtEDbCN24n+6dVpfFgyGziy899Pd3fQsGQ6E8OgXySDNr9dDfZnFOYSh/TA+eZAsLp7 N+OPKguGnR+LfmocQyrFeNC+rnaojX0R7QbXePblMLi95q16obL1cCN/K0kkzn1ixqgH kuIKt79B7PUcJV/XNznGHD3TsTGpvu7IgE0R6mg1vFUrlGu6lN0YLA+nKOho3v5mThxX 5S3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="jpDOT/tL"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j17si3836158ejk.360.2020.07.27.07.31.16; Mon, 27 Jul 2020 07:31:38 -0700 (PDT) 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=@kernel.org header.s=default header.b="jpDOT/tL"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732175AbgG0OX4 (ORCPT + 99 others); Mon, 27 Jul 2020 10:23:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:53258 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732165AbgG0OXw (ORCPT ); Mon, 27 Jul 2020 10:23:52 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 95BC22083E; Mon, 27 Jul 2020 14:23:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859832; bh=/EPXNNpRbRs1wsCdJFgsArdWLV8XF3Yj+xCF+ejtOM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jpDOT/tL1zQW/FS2dZPtaUHQzKCKvVu4jxoUiJcfou9uiE7Z+8vL3xuadDtVY8ABM fKV8EJa+PYFzAPmJDJTp8OLLrFV5oGpiYi8wz9Cx92nCERjoJjVX4LXrIFleNdzGe0 8kSu+oOaG4dWCaGqBRauoLr33+rBo8MdbkcLG35E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Taehee Yoo , Jakub Kicinski , "David S. Miller" , Sasha Levin Subject: [PATCH 5.7 082/179] netdevsim: fix unbalaced locking in nsim_create() Date: Mon, 27 Jul 2020 16:04:17 +0200 Message-Id: <20200727134936.676225376@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134932.659499757@linuxfoundation.org> References: <20200727134932.659499757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Taehee Yoo [ Upstream commit 2c9d8e01f0c6017317eee7638496173d4a64e6bc ] In the nsim_create(), rtnl_lock() is called before nsim_bpf_init(). If nsim_bpf_init() is failed, rtnl_unlock() should be called, but it isn't called. So, unbalanced locking would occur. Fixes: e05b2d141fef ("netdevsim: move netdev creation/destruction to dev probe") Signed-off-by: Taehee Yoo Reviewed-by: Jakub Kicinski Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/netdevsim/netdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index 2908e0a0d6e19..23950e7a0f81e 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -302,7 +302,7 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port) rtnl_lock(); err = nsim_bpf_init(ns); if (err) - goto err_free_netdev; + goto err_rtnl_unlock; nsim_ipsec_init(ns); @@ -316,8 +316,8 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port) err_ipsec_teardown: nsim_ipsec_teardown(ns); nsim_bpf_uninit(ns); +err_rtnl_unlock: rtnl_unlock(); -err_free_netdev: free_netdev(dev); return ERR_PTR(err); } -- 2.25.1