Commit 9a3becd5 authored by Joel Pepper's avatar Joel Pepper Committed by Kleber Sacilotto de Souza

usb: gadget: uvc: configfs: Prevent format changes after linking header

BugLink: https://bugs.launchpad.net/bugs/1853881

[ Upstream commit cb2200f7 ]

While checks are in place to avoid attributes and children of a format
being manipulated after the format is linked into the streaming header,
the linked flag was never actually set, invalidating the protections.
Update the flag as appropriate in the header link calls.
Signed-off-by: default avatarJoel Pepper <joel.pepper@rwth-aachen.de>
Reviewed-by: default avatarKieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 187b2093
......@@ -807,6 +807,7 @@ static int uvcg_streaming_header_allow_link(struct config_item *src,
format_ptr->fmt = target_fmt;
list_add_tail(&format_ptr->entry, &src_hdr->formats);
++src_hdr->num_fmt;
++target_fmt->linked;
out:
mutex_unlock(&opts->lock);
......@@ -845,6 +846,8 @@ static int uvcg_streaming_header_drop_link(struct config_item *src,
break;
}
--target_fmt->linked;
out:
mutex_unlock(&opts->lock);
mutex_unlock(su_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment