Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2311532imm; Mon, 28 May 2018 05:53:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqFCfpWt+IEsOfKQ2x5NXnIU9gSMw0AjPqJdU7azcEh3UYLubCCAFDmv8bGvBmSZ7thaOmu X-Received: by 2002:a17:902:548f:: with SMTP id e15-v6mr13996379pli.314.1527512009869; Mon, 28 May 2018 05:53:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527512009; cv=none; d=google.com; s=arc-20160816; b=YkCvp+ZJD7CmuiARqoJo/KIC3CtnQ0sD1Rx5Mt5ezKdMcUTgIgOIJiQhe3JyULHrVx znk38tQyYSDAZ4ukC88LsdrlNVDUYi4GifNN91uGidd/MoKMqCGtEsZhqIouT4ooEdhs alttneY8wk4eq/x/OyOfqjbSsSl3Fl4T6McVrNnVkwcULaiw9n4W1e9GZFDWbmbZT/0c BLeyS0GjZr5E4Ry8D09nlJPGJhJIF7fb3JlXZEc1TVb4chY5oy3XAakW9rbm35xNqc8W lYB0lxJVtUtWXkWG49RTSEQ+S5C+g3ldRlP3xt+Fs9Kmf9sH0+v/IXK/qpG+Ub3xcxDk m/bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=6yZ78K32RsS9MpYuF2hCbDJlcov7i9N8AR0lNusSdQE=; b=bSIJb58iWsR70sJA57LBUA5AyPivHQEhwA60zQwvAoYrU2u7DLW9Y5da4Hysrq1A1/ NPpIMGQYT9KaJJqLys++YMgSFcxIhnw2tZRzpigelrGDfspZc3HXoma0JmnxrpjNHAFs PG6sRCOP7ohnH1lQmcxRqHyOPrZMrrTr0L7oQPxmulS7NyLIP6wiY3njrpfGitP/tYgg Q+/MAutfyqN231Gb1pFbMUsuZBfKEnrWtDItAAvfMgDONiBGhrZLU+A8M+GQE4Fgd5cY dsgfCeZwoHIDAZwJGioPK8ikkOPunx618QI/rCRdgXCJIDmArR2Sq1PNFzsj3rOSOW4z eQ7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Zy1iCvKO; 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 m67-v6si24142437pgm.413.2018.05.28.05.53.15; Mon, 28 May 2018 05:53:29 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Zy1iCvKO; 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 S1164442AbeE1Kzx (ORCPT + 99 others); Mon, 28 May 2018 06:55:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:44252 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164426AbeE1Kzo (ORCPT ); Mon, 28 May 2018 06:55:44 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 1A0A320845; Mon, 28 May 2018 10:55:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504943; bh=kLPK1aogjQvSqFltY36FwMtP9Do3U0mX+5i4aBouQHM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zy1iCvKOrdpIFiHFSy0DcNOQ1NApdC7XkvRZKNlXYZX3oGWLtWGhDSN9xQYbHZJwm xUhgMHVg2tL885pi+IMvIrlIIbrPCP4Tx0hn0r2at/PLd5uUFKyqrg6gNXpeDCp+l7 6qFRXQaovZy+S1H5a4vICCxBRT0aGrrQiRCWnxaE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 286/496] macsec: missing dev_put() on error in macsec_newlink() Date: Mon, 28 May 2018 12:01:11 +0200 Message-Id: <20180528100331.887783491@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit 5dcd8400884cc4a043a6d4617e042489e5d566a9 ] We moved the dev_hold(real_dev); call earlier in the function but forgot to update the error paths. Fixes: 0759e552bce7 ("macsec: fix negative refcnt on parent link") Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/macsec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -3248,7 +3248,7 @@ static int macsec_newlink(struct net *ne err = netdev_upper_dev_link(real_dev, dev); if (err < 0) - goto unregister; + goto put_dev; /* need to be already registered so that ->init has run and * the MAC addr is set @@ -3284,7 +3284,8 @@ del_dev: macsec_del_dev(macsec); unlink: netdev_upper_dev_unlink(real_dev, dev); -unregister: +put_dev: + dev_put(real_dev); unregister_netdevice(dev); return err; }