Fixes possible crash if sgv pools destroyed too early.
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Tue, 14 Jul 2009 16:56:07 +0000 (16:56 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Tue, 14 Jul 2009 16:56:07 +0000 (16:56 +0000)
Reported by Smadar Gonen <smadar.gn@gmail.com>

git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@955 d57e44dd-8a1f-0410-8b47-8ef2f437770f

scst/src/dev_handlers/scst_user.c

index 0160a18..f2d1ac1 100644 (file)
@@ -3094,8 +3094,8 @@ static int dev_user_release(struct inode *inode, struct file *file)
        scst_unregister_virtual_device(dev->virt_id);
        scst_unregister_virtual_dev_driver(&dev->devtype);
 
-       sgv_pool_del(dev->pool_clust);
-       sgv_pool_del(dev->pool);
+       sgv_pool_flush(dev->pool_clust);
+       sgv_pool_flush(dev->pool);
 
        TRACE_DBG("Unregistering finished (dev %p)", dev);
 
@@ -3106,6 +3106,9 @@ static int dev_user_release(struct inode *inode, struct file *file)
 
        wait_for_completion(&dev->cleanup_cmpl);
 
+       sgv_pool_del(dev->pool_clust);
+       sgv_pool_del(dev->pool);
+
        up_write(&dev->dev_rwsem); /* to make the debug check happy */
 
        TRACE_DBG("Releasing completed (dev %p)", dev);