Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

misc: fastrpc: Use fastrpc_map_put in fastrpc_map_create on fail

Move the kref_init right after the allocation so that we can use
fastrpc_map_put on any following error case.

Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20221125071405.148786-6-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Abel Vesa and committed by
Greg Kroah-Hartman
334f1a1c 6f18c7e8

+3 -2
+3 -2
drivers/misc/fastrpc.c
··· 735 735 return -ENOMEM; 736 736 737 737 INIT_LIST_HEAD(&map->node); 738 + kref_init(&map->refcount); 739 + 738 740 map->fl = fl; 739 741 map->fd = fd; 740 742 map->buf = dma_buf_get(fd); ··· 763 761 map->size = len; 764 762 map->va = sg_virt(map->table->sgl); 765 763 map->len = len; 766 - kref_init(&map->refcount); 767 764 768 765 if (attr & FASTRPC_ATTR_SECUREMAP) { 769 766 /* ··· 792 791 attach_err: 793 792 dma_buf_put(map->buf); 794 793 get_err: 795 - kfree(map); 794 + fastrpc_map_put(map); 796 795 797 796 return err; 798 797 }