Received: by 10.192.165.156 with SMTP id m28csp459669imm; Mon, 16 Apr 2018 03:19:54 -0700 (PDT) X-Google-Smtp-Source: AIpwx49n7LAoIhjIz24BwtRYquIeZ9oMCDFm63rmoOux3dgSSsSz8J7SZkfqe7nvjZfUGDMYQAKd X-Received: by 2002:a17:902:bc06:: with SMTP id n6-v6mr14589299pls.97.1523873994029; Mon, 16 Apr 2018 03:19:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523873993; cv=none; d=google.com; s=arc-20160816; b=WQNrMCAB75p2to1ehfBf4P5LgSYOpUN7BP8QEzNPmz/nH5TbpPBLDHAVEtkYYc39hk hx7XOqGZYhYvZy9z76sb6GKzOjHp88OVkCeFuYOJqkryCnNqUQ+nFxJWRhbJHkp694oi yh/NHlTbAACHaLnWHx03IljmXRq6IpnEkwi+Gc0e8gduipNwoDHOMJ9D7yaRJkLaGbXw iDITFkNNmZNaPhsHOcklGojmX2PwAasJCDiQQGt6kKA9ETYzbSodj8BQcY0bHXZzy4OG YAtLcOeCLMg8Jckyw19vh/nY31vZq64GxEgtDNF3qr1l55PQ7IzMe66b8Fn/bg9do7R3 Eygg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=AUpoqEeQQ/Gb+GfxiPwS6/YyMq8bisHbTV2R5yG9lws=; b=lj/kgSeCH8S+VfWK4k2rNUY+ppg+dG8a6FrdZZgRgCitg53VUHqtfp19WFPN9lzhEm jnDraxYvzLHvZ0VT2EaxEuPNiRzPVCXP7QV3bojBr/pObeGPo170aKZgSdIF1Qd32NCp 435ikMvUx9skd087MwTishvQyus53/5/Oo2wed1h1FmXB0xWvbtFzCDQsNj/Z5Ja8gBI 1BCqMQW/P0aNzUjlkhtCIfhLOE3dc3ALnb9830SnZIN5TTVv9Kf9h69cCevuxOAjT9Ic 25TyfcZVetnK0i6qX57Gc7qPGKlZABa7ZyfpZrNZnsE13qrUieIDeQSDOp/qqYa6xxav L2rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=jOLnODIF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n65si9244800pga.90.2018.04.16.03.19.39; Mon, 16 Apr 2018 03:19:53 -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=@oracle.com header.s=corp-2017-10-26 header.b=jOLnODIF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754027AbeDPKSZ (ORCPT + 99 others); Mon, 16 Apr 2018 06:18:25 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:47862 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751086AbeDPKSX (ORCPT ); Mon, 16 Apr 2018 06:18:23 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w3GAGjai161545; Mon, 16 Apr 2018 10:18:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type : in-reply-to; s=corp-2017-10-26; bh=AUpoqEeQQ/Gb+GfxiPwS6/YyMq8bisHbTV2R5yG9lws=; b=jOLnODIFSD78hZXJ0PqsD6gKr3N2sgC6UmUXoAQ9wIkQI89VwWKkbrf20s7Zx9QclXLv FIZvq4GUCSJwEhX+je9pNEwGrSGhPBL0eOsg7R5fBsYAGLa8PC+hmDdHdJRhapeB2fTn iJniiYeKQIqUtzfhjx//xHeiclLK2RELaemmuTVEcE0jK0O5rsIEBYO4lyMFuHDm1YBR 8g/E8mOW/12/UtiGvlGxMwkpoxrkKHj5T1d21bA+5kx57LOGyhHeKbbp7y8yUZQWnnyd poEsuHBgHAKRnVDXJUF1fPSWMU9HjQ4USIAqSn81TRNymGGPWn71ySpTqX2q1pQbJA6w WA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2hbamnmc8b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Apr 2018 10:18:00 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w3GAHxAS004131 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Apr 2018 10:18:00 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w3GAHwDk008535; Mon, 16 Apr 2018 10:17:59 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 16 Apr 2018 03:17:57 -0700 Date: Mon, 16 Apr 2018 13:17:50 +0300 From: Dan Carpenter To: Laura Abbott , Sabrina Dubroca Cc: "David S. Miller" , Linux Kernel Mailing List , netdev@vger.kernel.org Subject: [PATCH net] Revert "macsec: missing dev_put() on error in macsec_newlink()" Message-ID: <20180416101750.GA19613@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180414223121.GA7475@bistromath.localdomain> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8864 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1804160097 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch is just wrong, sorry. I was trying to fix a static checker warning and misread the code. The reference taken in macsec_newlink() is released in macsec_free_netdev() when the netdevice is destroyed. This reverts commit 5dcd8400884cc4a043a6d4617e042489e5d566a9. Reported-by: Laura Abbott Fixes: 5dcd8400884c ("macsec: missing dev_put() on error in macsec_newlink()") Signed-off-by: Dan Carpenter Acked-by: Sabrina Dubroca --- I sent this earlier but I messed up the CC list. I've updated the commit message as well. drivers/net/macsec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 9cbb0c8a896a..7de88b33d5b9 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -3277,7 +3277,7 @@ static int macsec_newlink(struct net *net, struct net_device *dev, err = netdev_upper_dev_link(real_dev, dev, extack); if (err < 0) - goto put_dev; + goto unregister; /* need to be already registered so that ->init has run and * the MAC addr is set @@ -3316,8 +3316,7 @@ static int macsec_newlink(struct net *net, struct net_device *dev, macsec_del_dev(macsec); unlink: netdev_upper_dev_unlink(real_dev, dev); -put_dev: - dev_put(real_dev); +unregister: unregister_netdevice(dev); return err; } -- 2.16.2