usb: gadget: uvc: fix list not initialized in framebased format

A panic occur if make framebased format.

[    8.272086][  T204] list_add corruption. prev is NULL.
[    8.272104][  T204] ------------[ cut here ]------------
[    8.272106][  T204] kernel BUG at lib/list_debug.c:24!
[    8.285172][  T204] Call trace:
[    8.285454][  T204]  __list_add_valid+0x78/0xb8
[    8.285858][  T204]  uvcg_frame_make+0x100/0x1a8
[    8.286262][  T204]  configfs_mkdir+0x208/0x428
[    8.286664][  T204]  vfs_mkdir+0xe8/0x170
[    8.287023][  T204]  do_mkdirat+0x98/0x1a4
[    8.287381][  T204]  __arm64_sys_mkdirat+0x20/0x2c
[    8.287806][  T204]  el0_svc_common+0xac/0x1ac
[    8.288197][  T204]  do_el0_svc+0x1c/0x28
[    8.288546][  T204]  el0_svc+0x10/0x1c
[    8.288873][  T204]  el0_sync_handler+0x68/0xac
[    8.289274][  T204]  el0_sync+0x160/0x180

Fixes: 02bfaf0477 ("FROMLIST: usb: gadget: uvc: configfs: add framebased format support")
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
Change-Id: Ibbba0ac5035945398fd866a6028c4b4cce4b79f7
This commit is contained in:
Bin Yang
2023-07-28 09:04:27 +08:00
committed by Tao Huang
parent cf18504ebe
commit 504d18fc1c

View File

@@ -2103,6 +2103,7 @@ static struct config_group *uvcg_framebased_make(struct config_group *group,
f->desc.bCopyProtect = 0;
f->desc.bVariableSize = 1;
INIT_LIST_HEAD(&f->fmt.frames);
f->fmt.type = UVCG_FRAMEBASED;
config_group_init_type_name(&f->fmt.group, name,
&uvcg_framebased_type);