Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2318908pxb; Mon, 20 Sep 2021 18:41:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmUXYPXJchaqCPQNefCWyar83dHUmglInG8EgYVY1t/oZ+qPLV3ubbsS7slrqkCOD00Uuf X-Received: by 2002:a50:da07:: with SMTP id z7mr5216355edj.301.1632188491033; Mon, 20 Sep 2021 18:41:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188491; cv=none; d=google.com; s=arc-20160816; b=XRIiUWKdM25PcLlpm55N+L7u9zXAIaJ5wO6HR9grfluQKUMX5RJ9CPtMNYhRb7VTgL +yd8XgJUXKIxb5xGg7mUKRHlqwOv1OUskMwfHFhAfzq9z3Izwnx5k32OkcEEOL3GXzK7 kNE2W7G38EnZiQJGRzeuQR7dvdSLUEf47k7v451QaLZTRZ6eabuiWmhFik4A70d/mZ0/ r2Bg+PBrurY7VFxE0950cSz9ZeIAoU8a/CQF8nTidRyr5OT9hQq54MaeIwBeokRnj4KB YMJq+FkhtWfwArcx+8kXsa4eo89JRAInoCBe7tYrHiOQtZvnedmc3ogrkrXXb/lxpU3t lNHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=s2dEkZ+acDYgVQM1TKEcEcGHt5W930DYgf27Jzs9Yfo=; b=y/mP6f0Jh5XZdBRqhyv4w8QMQ3bBRkpYq5h6xvkOIbLmGaWD1yqBLy2oh8zGCaoS3p kzUq46FkONUrX9eIo69TVGevOemQbzZe4XsYs7X0djUECnVmzESoqK0IWL2vtcNZF8hH xQsQ0SCGMekcTbXAFncL5jXN5QBG1VFuofkQVnXrllENfdnQyB94k7HQuP2mzkRgdW34 PVV645qbO6Ep5wwr0G4y8n/gyNfbMHeL4jUeUqARmpbm7IttrgYoaI5GH4QOrIiXyL2E ULa3Y8YmZ1SBC63w+72SDMk6t9sOEy8sV35e1RH35GuZwPVNSBw3lMlVeJbwp4NGxAXv Mlwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=paWapvEN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r24si9757772ejy.194.2021.09.20.18.41.07; Mon, 20 Sep 2021 18:41:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=paWapvEN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240245AbhITQrJ (ORCPT + 99 others); Mon, 20 Sep 2021 12:47:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:35086 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236904AbhITQrE (ORCPT ); Mon, 20 Sep 2021 12:47:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9211561177; Mon, 20 Sep 2021 16:45:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632156337; bh=+6b2Pgjx+/2WH6XF7xjweivXSPduCFRwvN5Du56Y924=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=paWapvENhfJ7RkTenmpofFgqAD4J6M/IGU1qLI4/9B3mqYL00q94drJJue0Npwggd TJxBvW9Jz08p7UWhVj/2fzCjhx1EN6GRnJrgoMJtt6JDu9TRX2g1zRe7/YLYAaXZzv ElgCwj12WFcmM5cJDDi+FgYJju6L2If7dxD/ChEY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Skripkin , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 4.4 013/133] media: stkwebcam: fix memory leak in stk_camera_probe Date: Mon, 20 Sep 2021 18:41:31 +0200 Message-Id: <20210920163913.041211033@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163912.603434365@linuxfoundation.org> References: <20210920163912.603434365@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Skripkin commit 514e97674400462cc09c459a1ddfb9bf39017223 upstream. My local syzbot instance hit memory leak in usb_set_configuration(). The problem was in unputted usb interface. In case of errors after usb_get_intf() the reference should be putted to correclty free memory allocated for this interface. Fixes: ec16dae5453e ("V4L/DVB (7019): V4L: add support for Syntek DC1125 webcams") Cc: stable@vger.kernel.org Signed-off-by: Pavel Skripkin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/usb/stkwebcam/stk-webcam.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/media/usb/stkwebcam/stk-webcam.c +++ b/drivers/media/usb/stkwebcam/stk-webcam.c @@ -1353,7 +1353,7 @@ static int stk_camera_probe(struct usb_i if (!dev->isoc_ep) { STK_ERROR("Could not find isoc-in endpoint"); err = -ENODEV; - goto error; + goto error_put; } dev->vsettings.palette = V4L2_PIX_FMT_RGB565; dev->vsettings.mode = MODE_VGA; @@ -1366,10 +1366,12 @@ static int stk_camera_probe(struct usb_i err = stk_register_video_device(dev); if (err) - goto error; + goto error_put; return 0; +error_put: + usb_put_intf(interface); error: v4l2_ctrl_handler_free(hdl); v4l2_device_unregister(&dev->v4l2_dev);