Message ID | 20221119085923.114889-1-xiujianfeng@huawei.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp628600wrr; Sat, 19 Nov 2022 01:25:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf5dTVTGjHCe36Tgr+CzZc/Nrc31/f28Hs/9MOzrzLvQpMztLeZBARI/IEbxc4un2HIogrTI X-Received: by 2002:a17:902:9897:b0:186:a98c:4ab8 with SMTP id s23-20020a170902989700b00186a98c4ab8mr3206952plp.118.1668849941292; Sat, 19 Nov 2022 01:25:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668849941; cv=none; d=google.com; s=arc-20160816; b=FgARjGO1EA2BIPSu+iAViiz+XHUtk+PDTJzvvpPBlneBSwmy/sGLLhWLemfSpErgGl DWuhC7Ho5ngKVOIcHTaFoY+7M8pzD5OeRUYUMaITfkPnqT1wJagWhoPvUgQrQE2lwgLu MJt661tvRgWA3RyKNMyRHwMOFKdR7eoFDbYggJTlrkhbsLhBm57swkLICvm+fSzsF2Ic BEYnyyJMNcn1UXP/7xDObCnneKCKQWJzVkO8oypzeHCZF7Df3apd2eOq0dVXJRDQmIay 1gjc0MG2tlsSmlCpJ4U3F2f4u3ed7SG/5Y2O4y9v0aZ1ad3MPCrfNXvN7bWcErT42XgR YEqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=vfjdOV/y5aE3k6OtfP3nyjtXWwtXJBkqYyY5/oM3TFI=; b=sgiw6kAkNWtxkqOCdEtkt9Gtja12UU5k6nJthyTjEIPUecrzmMRB9KABSn8uMjgMSU ZVDs7jbddiJxCjgEPqu4f6x98x96sAgK8j57fWMaBWnXHhX6dF84AH8SHwV4qlu0L5wu 3shHRFwDL9cG02jaRm8+gw/JIEtBNDoPpduH8Ms0zMf5DPaUMaF+GHipH91wz6sesRlR 9mKrBwliyPuUuQueTKYYMALsjpYWhCuTPKDSmrqgPECM26SIGEOhf+zNrbAA0xez2v0M 2RB4y6ufkkHNJtSrODF16g1YlZEaONhwte1peBE4yx82tpP3OQnzAXc1vHx6Cl0wADmk HYvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o4-20020a170902d4c400b00182d09b284dsi6605246plg.310.2022.11.19.01.25.27; Sat, 19 Nov 2022 01:25:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231666AbiKSJCf (ORCPT <rfc822;kkmonlee@gmail.com> + 99 others); Sat, 19 Nov 2022 04:02:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230266AbiKSJCc (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 19 Nov 2022 04:02:32 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEEE79DBA5 for <linux-kernel@vger.kernel.org>; Sat, 19 Nov 2022 01:02:31 -0800 (PST) Received: from dggpeml500023.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4NDndf0h6HzFqQ9; Sat, 19 Nov 2022 16:59:18 +0800 (CST) Received: from ubuntu1804.huawei.com (10.67.174.58) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 19 Nov 2022 17:02:29 +0800 From: Xiu Jianfeng <xiujianfeng@huawei.com> To: <jgross@suse.com>, <boris.ostrovsky@oracle.com>, <tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>, <dave.hansen@linux.intel.com>, <hpa@zytor.com>, <jeremy@goop.org> CC: <x86@kernel.org>, <xen-devel@lists.xenproject.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH 0/2] x86/xen: Fix memory leak issue Date: Sat, 19 Nov 2022 16:59:21 +0800 Message-ID: <20221119085923.114889-1-xiujianfeng@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.174.58] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500023.china.huawei.com (7.185.36.114) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749915995904009221?= X-GMAIL-MSGID: =?utf-8?q?1749915995904009221?= |
Series |
x86/xen: Fix memory leak issue
|
|
Message
Xiu Jianfeng
Nov. 19, 2022, 8:59 a.m. UTC
The new string allocated by kasprintf() is leaked on error path Xiu Jianfeng (2): x86/xen: Fix memory leak in xen_smp_intr_init{_pv}() x86/xen: Fix memory leak in xen_init_lock_cpu() arch/x86/xen/smp.c | 16 ++++++++++++---- arch/x86/xen/smp_pv.c | 8 ++++++-- arch/x86/xen/spinlock.c | 3 ++- 3 files changed, 20 insertions(+), 7 deletions(-)
Comments
On 19.11.22 09:59, Xiu Jianfeng wrote: > The new string allocated by kasprintf() is leaked on error path > > Xiu Jianfeng (2): > x86/xen: Fix memory leak in xen_smp_intr_init{_pv}() > x86/xen: Fix memory leak in xen_init_lock_cpu() > > arch/x86/xen/smp.c | 16 ++++++++++++---- > arch/x86/xen/smp_pv.c | 8 ++++++-- > arch/x86/xen/spinlock.c | 3 ++- > 3 files changed, 20 insertions(+), 7 deletions(-) > Hmm, I think it would make more sense to always store the name generated via kasprintf() in the percpu variable (independently from succeeding to bind the irq), and in the related free function to always kfree() it and set it to NULL again. This would result in less code. Juergen
Hi, 在 2022/11/23 23:23, Juergen Gross 写道: > On 19.11.22 09:59, Xiu Jianfeng wrote: >> The new string allocated by kasprintf() is leaked on error path >> >> Xiu Jianfeng (2): >> x86/xen: Fix memory leak in xen_smp_intr_init{_pv}() >> x86/xen: Fix memory leak in xen_init_lock_cpu() >> >> arch/x86/xen/smp.c | 16 ++++++++++++---- >> arch/x86/xen/smp_pv.c | 8 ++++++-- >> arch/x86/xen/spinlock.c | 3 ++- >> 3 files changed, 20 insertions(+), 7 deletions(-) >> > > Hmm, I think it would make more sense to always store the name generated > via kasprintf() in the percpu variable (independently from succeeding to > bind the irq), and in the related free function to always kfree() it and > set it to NULL again. > > This would result in less code. Thanks, It's good to me, already sent v2. > > > Juergen