From: Daniel Stodden Subject: [PATCH 1 of 8] blktap: Fix tap kobj double unref in sysfs_destroy Date: Fri, 26 Feb 2010 16:04:49 -0000 Message-ID: <3ea95de27eaed11b87a5.1267200289@agari.van.xensource.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2824448579596361550==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Xen Cc: Jeremy Fitzhardinge List-Id: xen-devel@lists.xenproject.org --===============2824448579596361550== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit It's that final put_device in device_unregister which is supposed to clear the caller's reference. Subtle indeed, because refcount went 2->3 when after sysfs_destroy: +1 for our own ring->dev +1 for the open sysfs ./remove attribute +1 for the callback scheduled Drops to 1 in device_unregister and 0 only after leaving callbacks. Signed-off-by: Daniel Stodden --===============2824448579596361550== Content-Type: text/x-patch; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=fix-double-free.diff # HG changeset patch # User Daniel Stodden # Date 1267197951 28800 # Node ID 3ea95de27eaed11b87a5c608629f5089b0b33a73 # Parent 6cee7e3206311d4556e5bb75ceb522e4e293d4d1 blktap: Fix tap kobj double unref in sysfs_destroy. It's that final put_device in device_unregister which is supposed to clear the caller's reference. Subtle indeed, because refcount went 2->3 when after sysfs_destroy: +1 for our own ring->dev +1 for the open sysfs ./remove attribute +1 for the callback scheduled Drops to 1 in device_unregister and 0 only after leaving callbacks. Signed-off-by: Daniel Stodden diff -r 6cee7e320631 -r 3ea95de27eae drivers/xen/blktap/sysfs.c --- a/drivers/xen/blktap/sysfs.c Fri Feb 26 07:25:50 2010 -0800 +++ b/drivers/xen/blktap/sysfs.c Fri Feb 26 07:25:51 2010 -0800 @@ -360,7 +360,6 @@ !atomic_read(&tap->ring.sysfs_refcnt))) return -EAGAIN; - put_device(dev); device_schedule_callback(dev, device_unregister); return 0; --===============2824448579596361550== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============2824448579596361550==--