summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJoel Pepper <joel.pepper@rwth-aachen.de>2018-05-29 21:02:12 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-25 15:54:09 +0100
commit66fc927508a01f133ac164d637800c198834ab35 (patch)
tree8f74047e9bb0962535ad104a205478956787045c /drivers
parent3adae6c6d3f4997f611751310b8df42166ea96d1 (diff)
usb: gadget: uvc: configfs: Prevent format changes after linking header
[ Upstream commit cb2200f7af8341aaf0c6abd7ba37e4c667c41639 ] 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: Joel Pepper <joel.pepper@rwth-aachen.de> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/function/uvc_configfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c
index 74df80a25b46..a49ff1f5c0f9 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -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);