From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8BC1D2C0092 for ; Thu, 27 Jun 2013 19:43:25 +1000 (EST) Message-ID: <1372326166.18612.42.camel@pasglop> Subject: Re: [PATCH 3/8] vfio: add external user support From: Benjamin Herrenschmidt To: Stephen Rothwell Date: Thu, 27 Jun 2013 19:42:46 +1000 In-Reply-To: <20130627165929.3828c261c957845a549ad95b@canb.auug.org.au> References: <1372309356-28320-1-git-send-email-aik@ozlabs.ru> <1372309356-28320-4-git-send-email-aik@ozlabs.ru> <20130627165929.3828c261c957845a549ad95b@canb.auug.org.au> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Cc: kvm@vger.kernel.org, linux-doc@vger.kernel.org, Alexey Kardashevskiy , Alexander Graf , kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org, Alex Williamson , Paul Mackerras , "Paul E . McKenney" , linuxppc-dev@lists.ozlabs.org, David Gibson List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Thu, 2013-06-27 at 16:59 +1000, Stephen Rothwell wrote: > > +/* Allows an external user (for example, KVM) to unlock an IOMMU > group */ > > +static void vfio_group_del_external_user(struct file *filep) > > +{ > > + struct vfio_group *group = filep->private_data; > > + > > + BUG_ON(filep->f_op != &vfio_group_fops); > > We usually reserve BUG_ON for situations where there is no way to > continue running or continuing will corrupt the running kernel. Maybe > WARN_ON() and return? Not even that. This is a user space provided "fd", we shouldn't oops the kernel because we passed a wrong argument, just return -EINVAL or something like that (add a return code). Ben.