Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp133514ybc; Mon, 18 Nov 2019 21:54:29 -0800 (PST) X-Google-Smtp-Source: APXvYqwoG5Vz0dvoOz7Wxryu9WTJ0qkeoarNxFChxNtLYr2mR7OP2+vk2/HplpPCzWbblLz9vPLM X-Received: by 2002:a17:906:52c3:: with SMTP id w3mr33122451ejn.122.1574142869334; Mon, 18 Nov 2019 21:54:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574142869; cv=none; d=google.com; s=arc-20160816; b=eoJwZ2ZMrloVr9jpS9Jy7XFky12An+KFS/12PjxG8gi9/pOnMl/t6oSHVXdHC9AlvQ jFz8f8uZBkBLBl2MC7Nhax5nOu7AG7RVMh2b1MswepS157WPzBrUaUscSsCHWdgOlv65 x4iUCBIb1FGpmGC0lZnb4pCAgCsOQMbqtC/ldz20p69SnD8kuPHs8U/VW+khX98XX5dM 83nnRPherI2QNh0wiNnSPaQi9CiTJjR9J/8F14aBeGkOXyBNQ7KjONUVjsSNxkRJ+SaD 1lYL7j6yMbVuK/VrNZ4X3W/UC1CgbP79+3vGBtWzaT6ZSL98dmBfh0aft/OQwxCM4PcP Hv8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Oea2Upu9WIexWSIW04xFF4AyIaA5wQaLPGkjLDSQiYc=; b=jMgoC5/KemqHoSmTHUgVFvMfJzcXIR4MCZ7oSBV7KBNdR/2aOf0wVDDNZvnfjvo/hu hV4WS3q2In2Yxf/IFd7ahEBnUV7PmiWMWT4/Y7iMrTHkd56Y5KamrX0zgY3gjoeddRRS UzC1BTkqXqq62fJEe8whn2uOLZKp1O7qNJ/QD70I4n+hH1p6GRIOq/K7V+huMBZsHUuX YY5FsLitsWUBJ/XW88UfpAqoOeklgtEimUVhX80P8hubY2t9OFfnaMZHss0m4YAs/pOw oduJBl4tkAbKv8gsgB5dVT2Aux2hOpb0zb8X3uxPE4bpViwAmL2mWsrso3QvcSsmJKsT SVzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Y/Ydts1o"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9si10516114edy.221.2019.11.18.21.54.05; Mon, 18 Nov 2019 21:54:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Y/Ydts1o"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731899AbfKSFwT (ORCPT + 99 others); Tue, 19 Nov 2019 00:52:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:49948 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731891AbfKSFwP (ORCPT ); Tue, 19 Nov 2019 00:52:15 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 858F0208C3; Tue, 19 Nov 2019 05:52:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574142735; bh=FTJPCXRcxDMOJSToYEtqeq6c2U9ZZgf1fojkXraSZa8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y/Ydts1o9jUZITUswJvzjTTXqz4S/v8aDg+ncPqKyIYnbwzLtp6FxVY7y08xaHdE1 lo45WiFTDUCH2ADm9K5kyh96Z89+bz9AffVtPFF9syf91GZoblCHr2zE1L7jWQquQg aU8oyt+mBWLhzXyeYSI4KvvVs7PL9bw1PciqJu2Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurent Pinchart , Kieran Bingham , Sasha Levin Subject: [PATCH 4.14 183/239] usb: gadget: uvc: configfs: Drop leaked references to config items Date: Tue, 19 Nov 2019 06:19:43 +0100 Message-Id: <20191119051334.808680118@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119051255.850204959@linuxfoundation.org> References: <20191119051255.850204959@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Laurent Pinchart [ Upstream commit 86f3daed59bceb4fa7981d85e89f63ebbae1d561 ] Some of the .allow_link() and .drop_link() operations implementations call config_group_find_item() and then leak the reference to the returned item. Fix this by dropping those references where needed. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Signed-off-by: Sasha Levin --- drivers/usb/gadget/function/uvc_configfs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c index 844cb738bafd0..fc604439b25a1 100644 --- a/drivers/usb/gadget/function/uvc_configfs.c +++ b/drivers/usb/gadget/function/uvc_configfs.c @@ -543,6 +543,7 @@ static int uvcg_control_class_allow_link(struct config_item *src, unlock: mutex_unlock(&opts->lock); out: + config_item_put(header); mutex_unlock(su_mutex); return ret; } @@ -578,6 +579,7 @@ static void uvcg_control_class_drop_link(struct config_item *src, unlock: mutex_unlock(&opts->lock); out: + config_item_put(header); mutex_unlock(su_mutex); } @@ -2037,6 +2039,7 @@ static int uvcg_streaming_class_allow_link(struct config_item *src, unlock: mutex_unlock(&opts->lock); out: + config_item_put(header); mutex_unlock(su_mutex); return ret; } @@ -2077,6 +2080,7 @@ static void uvcg_streaming_class_drop_link(struct config_item *src, unlock: mutex_unlock(&opts->lock); out: + config_item_put(header); mutex_unlock(su_mutex); } -- 2.20.1