block: Should not free block device when add mount operation is failed 82/124382/1
authorpr.jung <pr.jung@samsung.com>
Tue, 11 Apr 2017 07:34:04 +0000 (16:34 +0900)
committerpr.jung <pr.jung@samsung.com>
Tue, 11 Apr 2017 07:34:04 +0000 (16:34 +0900)
- Add insert operation is succeed, so if main thread free block device,
then block thread can't use block device

Change-Id: Ia37923a433b3f62f4c584df1390bdd18241d2c3d
Signed-off-by: pr.jung <pr.jung@samsung.com>
src/block/block.c

index 838cc91..88b898a 100644 (file)
@@ -2079,7 +2079,6 @@ static int add_block_device(struct udev_device *dev, const char *devnode)
        thread_id = find_thread(bdev->data->devnode);
        if (thread_id < 0 || thread_id >= THREAD_MAX) {
                _E("Fail to find thread to add");
-               free_block_data(data);
                free_block_device(bdev);
                return -EPERM;
        }
@@ -2097,7 +2096,6 @@ static int add_block_device(struct udev_device *dev, const char *devnode)
        ret = add_operation(bdev, BLOCK_DEV_INSERT, NULL, (void *)data);
        if (ret < 0) {
                _E("Failed to add operation (insert %s)", devnode);
-               free_block_data(data);
                free_block_device(bdev);
                return ret;
        }
@@ -2105,8 +2103,6 @@ static int add_block_device(struct udev_device *dev, const char *devnode)
        ret = add_operation(bdev, BLOCK_DEV_MOUNT, NULL, NULL);
        if (ret < 0) {
                _E("Failed to add operation (mount %s)", devnode);
-               free_block_data(data);
-               free_block_device(bdev);
                return ret;
        }