diff options
| author | Will Deacon <willdeacon@google.com> | 2020-12-15 16:24:55 +0000 |
|---|---|---|
| committer | Giuliano Procida <gprocida@google.com> | 2021-01-05 15:58:52 +0000 |
| commit | b5b38b010efc2330816691b98bb6cb9ec7e80d68 (patch) | |
| tree | ef0babd693af520bc93eec2155b9947bf026d520 /lib/notifier-error-inject.c | |
| parent | 65ab8d94757f5e5198da6584c7f94509128e333e (diff) | |
ANDROID: usb: f_accessory: Don't corrupt global state on double registration
If acc_setup() is called when there is already an allocated instance,
misc_register() will fail but the error path leaves a dangling pointer
to freed memory in the global 'acc_dev' state.
Fix this by ensuring that the refcount is zero before we start, and then
using a cmpxchg() from NULL to serialise any concurrent initialisers.
Bug: 173789633
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I2c26289dcce7dbc493964516c49b05d04aaa6839
Signed-off-by: Giuliano Procida <gprocida@google.com>
Diffstat (limited to 'lib/notifier-error-inject.c')
0 files changed, 0 insertions, 0 deletions
