From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: Problem with error paths in various functions calling kvm_io_bus_unregister_dev Date: Wed, 12 Aug 2015 15:11:43 +0200 Message-ID: <55CB460F.2000305@redhat.com> References: <55CA0091.8090206@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org To: nick , gleb@kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:49908 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751072AbbHLNLt (ORCPT ); Wed, 12 Aug 2015 09:11:49 -0400 In-Reply-To: <55CA0091.8090206@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 11/08/2015 16:02, nick wrote: > Our we to just assume > that calls to kvm_io_bug_unregister_dev always succeed as I disagree due to > it allocating memory in kernel space that can easily fail. In additon I > was wondering how the maintainers would like me to handle these calls as > it's difficult due to it already being in error paths. Further more below > is a link to the files and how the calls to kvm_io_bus_register_dev are > executed in the respective error paths. > http://lxr.free-electrons.com/ident?i=kvm_io_bus_unregister_dev You're right; the fix is not simple. The best way is to introduce a new API to register or unregister multiple devices atomically. This gets rid of calls in the error paths. Paolo