From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753430AbcGLQKc (ORCPT ); Tue, 12 Jul 2016 12:10:32 -0400 Received: from mail-dm3nam03on0095.outbound.protection.outlook.com ([104.47.41.95]:35716 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750862AbcGLQKa convert rfc822-to-8bit (ORCPT ); Tue, 12 Jul 2016 12:10:30 -0400 X-Greylist: delayed 924 seconds by postgrey-1.27 at vger.kernel.org; Tue, 12 Jul 2016 12:10:29 EDT From: Jake Oshins To: Cathy Avery , KY Srinivasan , Haiyang Zhang , "bhelgaas@google.com" , Long Li CC: "vkuznets@redhat.com" , "devel@linuxdriverproject.org" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] PCI: hv: Fix interrupt cleanup path Thread-Topic: [PATCH] PCI: hv: Fix interrupt cleanup path Thread-Index: AQHR3FJ2k10aWLSfaECfwYRVwUL9g6AU8hKg Date: Tue, 12 Jul 2016 15:54:57 +0000 Message-ID: References: <1468337484-16074-1-git-send-email-cavery@redhat.com> In-Reply-To: <1468337484-16074-1-git-send-email-cavery@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=jakeo@microsoft.com; x-originating-ip: [2001:4898:80e8:9::563] x-ms-office365-filtering-correlation-id: ad0dffe9-b9c5-46af-0615-08d3aa6cdfd8 x-microsoft-exchange-diagnostics: 1;DM2PR0301MB0781;6:b75SEkaQ4aXL7KOHjZhEcgOBD/mdYNEowqT1xrEwab0szj+x+TM/yhZFHEGl9UPWdayME8eInBmBBZ4xvvk+h5wjxwvXkxPkSdzC1zGo+hiUjRxz3sJmPwECiwjkiivXG9rjBBSkXNNgRjjAhFlFA7rAbVmSU7lCbTKj2qs1B8G9y310o8gwIb/8XUU6IlNECrr+Gr0gxgkOSriIWL0bw7BQwwa0Ojhux6LJOGR4LE15rePv5OCx1kstFTbtyhcpVrWFSx86vAmkOzpOyjD3wCNqy6FvivyxFK/Cp8oqRCfy5vuZI19wP1MLzEf/fcDS+2juqA2SuCM50Psp/xKimw==;5:2Qd0Pqv3QQdee410/95/d6fkVFTy8vhVeDt9LI1YBqSZG2G/rq5EYkBccfVue5R4Y/KJDYC/1SQPZvpvZI5/seDd3Thjw/oAGFOokYMLjmeYhnO52pwO+aR0QRaYUuzQJTwdqofKGIFLqSn1ak226w==;24:Y7hCjhgokAZe8TzLdhpLwfBZwlDdQqVDFtWk3lIfASTA60vUL9AGX7ligI33mt9wF33aTwRj+QAcbsMfCXzF3nS9uoNksAIplmjTb4Unsfw=;7:SN8La3SoDqCFFktV5Tz2X9cRKzSJTBQJ0RU9mlP7BbykXM+vEYtpAmdvacEPNHgySX7JhZnr1MWxFFdbTTLM6x9dz/dhssBVRIPhdMp+KbIZL+KXzBw9az7qnczVrtFtzeppMZjgi8JJE7+f7yqRYhMc1xfzAHTWjjX8+HJ8aH4OqtOsEldlVz0oCdEiScc2RM/OFYRIE9LCJ0mGwImpuDoSV3FuF0JG4UwF1ka+lXVo3+ZWMN7CPWXu6ZyIA8Qx x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB0781; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055)(211936372134217); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(61426038)(61427038);SRVR:DM2PR0301MB0781;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB0781; x-forefront-prvs: 0001227049 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(199003)(13464003)(377454003)(189002)(10290500002)(10400500002)(5005710100001)(8990500004)(7736002)(3280700002)(5003600100003)(101416001)(77096005)(33656002)(76176999)(50986999)(8936002)(86612001)(9686002)(8676002)(11100500001)(54356999)(81166006)(4001450100002)(81156014)(97736004)(1511001)(5001770100001)(19580405001)(4326007)(19580395003)(189998001)(68736007)(87936001)(2950100001)(122556002)(2421001)(7846002)(2900100001)(2906002)(105586002)(106356001)(106116001)(86362001)(74316002)(305945005)(6116002)(102836003)(3660700001)(76576001)(2561002)(586003)(99286002)(7696003)(2501003)(92566002)(5002640100001)(10090500001)(3826002);DIR:OUT;SFP:1102;SCL:1;SRVR:DM2PR0301MB0781;H:DM2PR0301MB1232.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jul 2016 15:54:57.5936 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0301MB0781 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Cathy Avery [mailto:cavery@redhat.com] > Sent: Tuesday, July 12, 2016 8:31 AM > To: KY Srinivasan ; Haiyang Zhang > ; Jake Oshins ; > bhelgaas@google.com > Cc: vkuznets@redhat.com; devel@linuxdriverproject.org; linux- > pci@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: [PATCH] PCI: hv: Fix interrupt cleanup path > > SR-IOV disabled from the host causes a memory leak. > pci-hyperv usually first receives a PCI_EJECT notification > and then proceeds to delete the hpdev list entry in > hv_eject_device_work(). Later in hv_msi_free() since the > device is no longer on the device list hpdev is NULL > and hv_msi_free returns without freeing int_desc as part of > hv_int_desc_free(). > > Signed-off-by: Cathy Avery Acked-by: Jake Oshins > --- > drivers/pci/host/pci-hyperv.c | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c > index 7e9b2de..449d053 100644 > --- a/drivers/pci/host/pci-hyperv.c > +++ b/drivers/pci/host/pci-hyperv.c > @@ -732,16 +732,18 @@ static void hv_msi_free(struct irq_domain *domain, > struct msi_domain_info *info, > > pdev = msi_desc_to_pci_dev(msi); > hbus = info->data; > - hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); > - if (!hpdev) > + int_desc = irq_data_get_irq_chip_data(irq_data); > + if (!int_desc) > return; > > - int_desc = irq_data_get_irq_chip_data(irq_data); > - if (int_desc) { > - irq_data->chip_data = NULL; > - hv_int_desc_free(hpdev, int_desc); > + irq_data->chip_data = NULL; > + hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); > + if (!hpdev) { > + kfree(int_desc); > + return; > } > > + hv_int_desc_free(hpdev, int_desc); > put_pcichild(hpdev, hv_pcidev_ref_by_slot); > } > > -- > 2.5.0 I've tested this. It's a good fix. Please take it. -- Jake Oshins