Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp13408pja; Fri, 22 Nov 2019 02:48:35 -0800 (PST) X-Google-Smtp-Source: APXvYqw+Ly/UJD6ZISBbF8ljkBjXAZe1/gtHanC0zy7kBc5Eyq2maGcFDB5maUT/ZFOn29Qnflkl X-Received: by 2002:a17:906:7251:: with SMTP id n17mr21714758ejk.329.1574419715794; Fri, 22 Nov 2019 02:48:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574419715; cv=none; d=google.com; s=arc-20160816; b=Wsg6RHT+zXSoCsn5fL7johi5CTxC8riz123S3TTCXPCH30khh+iidqw7fPrAx0NkO7 EUcNbvuT5zzPnqGZBEqfCb5YAaLV4Knr97TNMzQWUrWhLk150uLMATToituQfMpvW3W+ kjVNZIrChp3iJg0TJgo4eSqJe5b6HjKtAM5JZ81mU/TGEqM20bHHTTxEFEUa53+OKH5e qRZ2DMcxJrGmxHY66+XhhTHtHYl1oGH76qzs8XdSD+xaNk01Id1uVff9jDG+SsyUinjx X64bU8A4wt72C7W9gcbxlimrusFxTEe4gb8f1Pf9pk1ABt5zImgyL12vlr8Qkeu67bUM HRgg== 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=7xf+xi0El+yLf4LRasU8dnnkKPPGZ8rJLUD07qMm3oE=; b=UlYUo6FNHozi0FoApIsPF5PbpYyVxuxuKl/vWT9NIzdFG4eXx3s1s2nmRUCdiz+dnf b+G9+i17SH4SXkqxl3EHD29Ah62Jd1sorJxJRhV6VBj7x8Gu5u156ArQVic3nnp4eb+/ 6eTG90RHRpdv35TKQyErScDW2YO3hfcnyY5R/fad+IYjw7avGB4rzVORIyydaYayzsKB DBXKVIRYU7baXv/tKeCOBn+O5QsPFDlfPZ/8QVZ9g2uELvkb3a8205GWt6Ocs6w75mQ+ XB2mVtxXYf4tAw2FuRN7paxoyX3YJcEEEcZf/OW/jfpClwdQzWYXbU6efOho3DKrAHaX Tg6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Heums4T0; 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 b6si2218779edb.189.2019.11.22.02.48.11; Fri, 22 Nov 2019 02:48:35 -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=Heums4T0; 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 S1727885AbfKVKoL (ORCPT + 99 others); Fri, 22 Nov 2019 05:44:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:49888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728832AbfKVKoF (ORCPT ); Fri, 22 Nov 2019 05:44:05 -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 30F1320715; Fri, 22 Nov 2019 10:44:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574419444; bh=rYpbs0dKw7NuXQPuiS1JlwOkFwEBEGYINd5c/qDq/JM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Heums4T0EEmlYkzghQkcDScRzdkxh7B/rQAmC07gPGSqWCDRgy19G8FkOD0UPJ4BR dR7A9l+Ms2bKvpu16sts5cCA9nPpKG8uHAnrMdjxjagdZbdY8YAaADQkgpZsToU1zx Q0n3+Npj95a7IKmrhL6tJoeCAN3zUW2qtT3uq9/w= 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.9 112/222] usb: gadget: uvc: configfs: Drop leaked references to config items Date: Fri, 22 Nov 2019 11:27:32 +0100 Message-Id: <20191122100911.324855796@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100830.874290814@linuxfoundation.org> References: <20191122100830.874290814@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 d7dcd39fe12cb..3803dda54666b 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; } @@ -584,6 +585,7 @@ static int uvcg_control_class_drop_link(struct config_item *src, unlock: mutex_unlock(&opts->lock); out: + config_item_put(header); mutex_unlock(su_mutex); return ret; } @@ -2047,6 +2049,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; } @@ -2091,6 +2094,7 @@ static int uvcg_streaming_class_drop_link(struct config_item *src, unlock: mutex_unlock(&opts->lock); out: + config_item_put(header); mutex_unlock(su_mutex); return ret; } -- 2.20.1