From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752620AbbHLNLu (ORCPT ); Wed, 12 Aug 2015 09:11:50 -0400 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 Subject: Re: Problem with error paths in various functions calling kvm_io_bus_unregister_dev To: nick , gleb@kernel.org References: <55CA0091.8090206@gmail.com> Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org From: Paolo Bonzini Message-ID: <55CB460F.2000305@redhat.com> Date: Wed, 12 Aug 2015 15:11:43 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <55CA0091.8090206@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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