[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 2/2] xen/arm: vpl011: Fix domain_vpl011_init error path
- To: Michal Orzel <michal.orzel@xxxxxxx>
- From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
- Date: Fri, 24 Mar 2023 09:35:47 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cnALK8E0o110EXwtcQdQ23kE05L8EfHdw8q4WTuFnt8=; b=i/sbvH2MgLpN7T7PAiGoqSJgR/mPxQK0GVK7nzxXBbjRmQPxClecurLg1pnqK2v98/TtTCEofyk/VfEDWJ5qZG8FZ+6Sz4Q3lCwLCsQvgq4IOYawXhEmT0JN0nfptWMPf1ltRS/d0AcsiLARJL/49rc3nJN7W637CGADHKinJHrYScWIT/Qc6+zo+eyEc6S7CAabbOqjaRVQFRL0WGOdxL4GS8K8UtQ1AjAowqF+8luJ5HoYVqOoUsEWi1ESA+paFR7cwyappMvzz0eAw8XDpuIy9xvvFc/Hi2HgrBcp8D+EXmS7iMOVzqX5NgwW0yfxEc4JzKnC9Pp1lBU+5rJeRA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XOpHdq00KAMPZ5ijqvNBOaifkm/pD2nm3DjasQ7DxD//fEBOVhCSIIOQmEXNg1MitIG9/DIi6poIMOsnZTNXCylkMn7Szkqv09huFmjVrJV5+/K1bdlP+aOYo50z24VWowkwIG2gZaTFOdTDkwxx3kTKkO78XRIHEsR/hDvNAsuJ0PJqZkA2+mzzig1K35Yf5B6Xm6jI0vhAF8rQaeWLmafeL8TWu85QGMD8+FqUEz4HSn731fw21LzCKmInjfV+n4ihgGlXOElGIFBmwRmNRAXLSmIf/jR03J6mreT4Sd/DeuBEtB2s1O07BAdGo0Iz2PsWV10T4Puw5Dwbb1Bopw==
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Fri, 24 Mar 2023 09:36:26 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
- Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Thread-index: AQHZXY9vXeyq3ki000ag4E2VLenl168JrNoA
- Thread-topic: [PATCH v2 2/2] xen/arm: vpl011: Fix domain_vpl011_init error path
> On 23 Mar 2023, at 13:56, Michal Orzel <michal.orzel@xxxxxxx> wrote:
>
> When vgic_reserve_virq() fails and backend is in domain, we should also
> free the allocated event channel.
>
> When backend is in Xen and call to xzalloc() returns NULL, there is no
> need to call xfree(). This should be done instead on an error path
> from vgic_reserve_virq(). Moreover, we should be calling XFREE() to
> prevent an extra free in domain_vpl011_deinit().
>
> In order not to repeat the same steps twice, call domain_vpl011_deinit()
> on an error path whenever there is more work to do than returning rc.
> Since this function can now be called from different places and more
> than once, add proper guards, use XFREE() instead of xfree() and move
> vgic_free_virq() to it.
>
> Take the opportunity to return -ENOMEM instead of -EINVAL when memory
> allocation fails.
>
> Fixes: 1ee1e4b0d1ff ("xen/arm: Allow vpl011 to be used by DomU")
> Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
Reviewed-by: Luca Fancellu <luca.fancellu@xxxxxxx>
|