mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
target: Fix a memory leak in target_dev_lba_map_store()
strsep() modifies its first argument. Make the pointer passed to kfree()
match the return value of kmalloc().
Fixes: 229d4f112f (commit "target_core_alua: Referrals configfs integration")
Signed-off-by: Bart Van Assche <[email protected]>
Cc: Hannes Reinecke <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Andy Grover <[email protected]>
Cc: Sagi Grimberg <[email protected]>
Signed-off-by: Nicholas Bellinger <[email protected]>
This commit is contained in:
parent
5261d86c5c
commit
f0a8afecb2
1 changed files with 3 additions and 3 deletions
|
|
@ -2017,14 +2017,14 @@ static ssize_t target_dev_lba_map_store(struct config_item *item,
|
|||
struct se_device *dev = to_device(item);
|
||||
struct t10_alua_lba_map *lba_map = NULL;
|
||||
struct list_head lba_list;
|
||||
char *map_entries, *ptr;
|
||||
char *map_entries, *orig, *ptr;
|
||||
char state;
|
||||
int pg_num = -1, pg;
|
||||
int ret = 0, num = 0, pg_id, alua_state;
|
||||
unsigned long start_lba = -1, end_lba = -1;
|
||||
unsigned long segment_size = -1, segment_mult = -1;
|
||||
|
||||
map_entries = kstrdup(page, GFP_KERNEL);
|
||||
orig = map_entries = kstrdup(page, GFP_KERNEL);
|
||||
if (!map_entries)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -2122,7 +2122,7 @@ out:
|
|||
} else
|
||||
core_alua_set_lba_map(dev, &lba_list,
|
||||
segment_size, segment_mult);
|
||||
kfree(map_entries);
|
||||
kfree(orig);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue