scsi: scsi_debug: Fix memory leak if LBP enabled and module is unloaded
[pandora-kernel.git] / drivers / scsi / scsi_debug.c
index 6888b2c..a9d1fea 100644 (file)
@@ -2045,8 +2045,7 @@ static void unmap_region(sector_t lba, unsigned int len)
                block = lba + alignment;
                rem = do_div(block, granularity);
 
-               if (rem == 0 && lba + granularity <= end &&
-                   block < map_size)
+               if (rem == 0 && lba + granularity < end && block < map_size)
                        clear_bit(block, map_storep);
 
                lba += granularity - rem;
@@ -3475,6 +3474,7 @@ static void __exit scsi_debug_exit(void)
        bus_unregister(&pseudo_lld_bus);
        root_device_unregister(pseudo_primary);
 
+       vfree(map_storep);
        if (dif_storep)
                vfree(dif_storep);