Received: by 10.223.176.5 with SMTP id f5csp806880wra; Sat, 3 Feb 2018 10:43:39 -0800 (PST) X-Google-Smtp-Source: AH8x227vg69gAH4Moq0Qow489BMw8oOMfXB2IyGGt3srVA4iYero3MMptEZ1YOlFFH6hQi0qG69v X-Received: by 10.98.20.77 with SMTP id 74mr5430234pfu.45.1517683419262; Sat, 03 Feb 2018 10:43:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517683419; cv=none; d=google.com; s=arc-20160816; b=H3KquP0WelhEIpw/dPD9LsfAfbXSj4C3mQgtwgcZB7d0oTIEMTvEhSLj1E08pnbjpV de2gtasj8AMnyog4OP5wcS5A8bfAFO4c2xwLUl0DSAVz7IphSuGYGmrk/Pk4VnV3LFEd v3zCaV1bCc00LnNUhIiRzqGnWiIfbc9t2dzcdXbojQMX2geZ+tD+75tL2B6eB0ilHEW+ pLuN8kJ4F4baMqeg5y9wvv9mC+va52/25uZbkUVsB1bTrx/34WnaICqd42SFVbjZeoF2 EeC6ZlTb/p3PEaUwaBG5OFEfJV5mL9UZd/AOEU+DHyEJwIGqPZsjgOXvFJcx/K7wSTnA gbrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=o3RbPUP26UWtTWRend7VL/uoal2Mj13F/SEdK8ngx0E=; b=bNzyrEwCLmXTeTDtfBRHHS2TCf/OLFX6hET83v4loqs+/JP99d1bEWKkpSx7yQwJ7q ZxiMJVfHLNMfjnKQO+1HKf+JieUeTXcrK73lfRTD7XpvjVBvpyQp3bu3PriYvhYbgPeq xPvt5k8MJN2dOcYg6ds+SXwk5WDJRzY+85v+wN+p9P+P6IE4i6FWP9UeOzl7cvZQONlf KTClrMISvkR0roGLWhO31Y+sN1CpFU8My+XdLCVoHc7m6Uji0SebWp731xBsnKdK4FzC VtBPn/y4TEJLJnYWsQt74x87FsgIni9Ub9v665uj6nB8RNyDvWjdG2SJU3LT6qNCdNUL ygXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Z6fUY/bb; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o24-v6si4096092pll.716.2018.02.03.10.43.24; Sat, 03 Feb 2018 10:43:39 -0800 (PST) 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=@microsoft.com header.s=selector1 header.b=Z6fUY/bb; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755094AbeBCSl6 (ORCPT + 99 others); Sat, 3 Feb 2018 13:41:58 -0500 Received: from mail-bl2nam02on0091.outbound.protection.outlook.com ([104.47.38.91]:45338 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753238AbeBCSDZ (ORCPT ); Sat, 3 Feb 2018 13:03:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=o3RbPUP26UWtTWRend7VL/uoal2Mj13F/SEdK8ngx0E=; b=Z6fUY/bbbTakIFXjcJDsicCUzmhX5MhIq2ltKoUyaiwifXHd3Obi4K5dEbrjAiUHT+gGik4qOZRNIx3V6xhwIvHALBmjfsm32g4ftfNDnSohqBTFZKt5fqyo+nrN9KTJUrDPFUrZwlh59sQj/mdIGB63o/xxjeQvs3pzEFuhh2U= Received: from BL0PR2101MB1027.namprd21.prod.outlook.com (52.132.20.161) by BL0PR2101MB0993.namprd21.prod.outlook.com (52.132.23.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.5; Sat, 3 Feb 2018 18:02:51 +0000 Received: from BL0PR2101MB1027.namprd21.prod.outlook.com ([fe80::a8da:b5d9:d710:9bf9]) by BL0PR2101MB1027.namprd21.prod.outlook.com ([fe80::a8da:b5d9:d710:9bf9%3]) with mapi id 15.20.0485.006; Sat, 3 Feb 2018 18:02:51 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Christophe JAILLET , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 101/110] mdio-sun4i: Fix a memory leak Thread-Topic: [PATCH AUTOSEL for 4.14 101/110] mdio-sun4i: Fix a memory leak Thread-Index: AQHTnRkFx/O+UvkReEy3cel1sFgsJQ== Date: Sat, 3 Feb 2018 18:01:31 +0000 Message-ID: <20180203180015.29073-101-alexander.levin@microsoft.com> References: <20180203180015.29073-1-alexander.levin@microsoft.com> In-Reply-To: <20180203180015.29073-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BL0PR2101MB0993;7:g6bGVJPTVpioZZrnqOxUPIDdY6ysRn8QXB9CgW6WOlMN6PQVKUc1jdTvFBzUIzMtfzffzkiEKRpCeFIFPLQIVdK/KyYBVXArsHOf3Bo1x+tFs+Nffhy24GJTCVwacVldRn/kM5yrlmhPUuJjg9ctpAQi+Ue0vk+6HPMlFXHayOw2SIc4dio66aTUsKXNC/EzLP4YzvniubEm5rJQXKVy457sBZ5Ow57PiKIVij21xZZaaLkRCItkIclKxW/cZqaJ x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 1c4f7203-5f4c-4379-7338-08d56b305796 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:BL0PR2101MB0993; x-ms-traffictypediagnostic: BL0PR2101MB0993: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(155761271638844); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231101)(2400082)(944501161)(93006095)(93001095)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011);SRVR:BL0PR2101MB0993;BCL:0;PCL:0;RULEID:;SRVR:BL0PR2101MB0993; x-forefront-prvs: 05724A8921 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(979002)(346002)(39380400002)(39860400002)(376002)(366004)(396003)(189003)(199004)(6436002)(186003)(3660700001)(8936002)(105586002)(2906002)(6346003)(6116002)(3280700002)(3846002)(97736004)(6486002)(1076002)(2950100002)(6666003)(81156014)(86362001)(76176011)(102836004)(2501003)(5250100002)(26005)(68736007)(10090500001)(81166006)(8676002)(59450400001)(53936002)(5660300001)(22452003)(305945005)(107886003)(7736002)(4326008)(86612001)(36756003)(99286004)(316002)(6512007)(10290500003)(72206003)(6506007)(14454004)(478600001)(25786009)(106356001)(2900100001)(54906003)(110136005)(66066001)(22906009)(217873001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:BL0PR2101MB0993;H:BL0PR2101MB1027.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: ht014SZMIRTSOtFM/Bl6bgL2zOilPMwizDNIHhbCWrGZEUt7FaHrJD4Siv0C0JrqSuFvdH6EF6TaHURFN6Npyw== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c4f7203-5f4c-4379-7338-08d56b305796 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Feb 2018 18:01:31.9096 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB0993 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit 56c0290202ab94a2f2780c449395d4ae8495fab4 ] If the probing of the regulator is deferred, the memory allocated by 'mdiobus_alloc_size()' will be leaking. It should be freed before the next call to 'sun4i_mdio_probe()' which will reallocate it. Fixes: 4bdcb1dd9feb ("net: Add MDIO bus driver for the Allwinner EMAC") Signed-off-by: Christophe JAILLET Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/phy/mdio-sun4i.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/mdio-sun4i.c b/drivers/net/phy/mdio-sun4i.c index 135296508a7e..6425ce04d3f9 100644 --- a/drivers/net/phy/mdio-sun4i.c +++ b/drivers/net/phy/mdio-sun4i.c @@ -118,8 +118,10 @@ static int sun4i_mdio_probe(struct platform_device *pd= ev) =20 data->regulator =3D devm_regulator_get(&pdev->dev, "phy"); if (IS_ERR(data->regulator)) { - if (PTR_ERR(data->regulator) =3D=3D -EPROBE_DEFER) - return -EPROBE_DEFER; + if (PTR_ERR(data->regulator) =3D=3D -EPROBE_DEFER) { + ret =3D -EPROBE_DEFER; + goto err_out_free_mdiobus; + } =20 dev_info(&pdev->dev, "no regulator found\n"); data->regulator =3D NULL; --=20 2.11.0