diff options
| author | Liangliang Lu <luliang@codeaurora.org> | 2017-11-07 18:53:08 +0800 |
|---|---|---|
| committer | Liangliang Lu <luliang@codeaurora.org> | 2017-11-07 18:53:08 +0800 |
| commit | a17c88a8083977fb552de7ec78b8bc1ddf554465 (patch) | |
| tree | ac520b2d8c84c5997223c684f2893e60c1324f74 /lib/mpi/mpi-inline.h | |
| parent | 91da619c3a57a7abcfa421200fd8aff275890772 (diff) | |
usb: gadget: ffs: Defer freeing memory on free_inst if in use
In the case of ffs_free_inst() called, whole ffs_dev structure is
freed. Userspace related API do not check if ffs_dev is freed or
not.
If ffs endpoint is opened by userspace, ffs_free_inst() is executed,
mark inst_exist to false but do not free instance structures until
ffs_data is freed.
Besides, ffs_data is allocated in ffs_fs_mount() while opts->dev
is allocated when ffs instance created. And opts->dev will
be freed when ffs instance freed.
If ffs instance is freed and created once, opts->dev is allocated
to new memory, but since ffs_fs_mount() won't be called in this
case, new opts->dev miss the ffs_data address and
ffs_data->private_data still point to old opts->dev address which
is already freed.
So new allocated opts->dev need to initialize opts->dev->ffs_data,
and ffs_private_data also need to update new allocated opts->dev
address.
Change-Id: Idea56f86c62da700926e8ce3a724d5be6295a4fd
Signed-off-by: Liangliang Lu <luliang@codeaurora.org>
Diffstat (limited to 'lib/mpi/mpi-inline.h')
0 files changed, 0 insertions, 0 deletions
