Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1421109pxb; Fri, 10 Sep 2021 05:41:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzP/LsZsPj1he26ssfjbxQWPGmvR571dOfSIs735zAmL21NWItmhmaXKsDOrtBBpF62HGBi X-Received: by 2002:a50:d0c8:: with SMTP id g8mr3786629edf.177.1631277718383; Fri, 10 Sep 2021 05:41:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631277718; cv=none; d=google.com; s=arc-20160816; b=x0yb/HtIlaM6EmkxsrxortZaZlf/8pffVVW6flYn8d6x4PUEN6ndha3vHBK8jcRlGN tXHiGmao/yLYbn+FByfmsuzk0ZTuHzstoAtxiMxU4AhW43s/vZgxv+rYMUAhpOTF4+Ul yr68dp7aaPSga5rN/loxxt4ILl1ZYRJgxIAWkZbXDMRXGNlpXeWD5mciDHO9GIDglIGD UlpaY3v5jQUaKUtYrVvEhNIOpBbt6wnTUOHFDHcjHOcCifF8SR+TffI9Stlwg7IaI/+L /b94LEbUbC/5WlkoQ3/oJZczk4j4bZtOudvGSe8TF6+/0ZO8KfVfEgj1m/vaKskYD7Yi FbSw== 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=521Xoo8xgulzxtL6pkHKw+t0xr3xasaNsqmcELPTBY4=; b=PhAPdyrhZ7dZEX7Zac1dMf9i0HU8TpCK7G95eO2BfM03rtYan9HX59dafkH+7H9DGS b3/G71Dn4roNWvv0qdE+0JlPZdxu2aBcTlwEv9/yVEIjARL7uq6XLhqodpL3y2tC+l1s rexxmF84pjrrQJI94xftjQxqBl9DyHlIx/UPXNnuYu4k7pvYZjp+ye2c2736bQoq2BmT Q/xHy9YCUJYrENY8jm7Ae7gWjnXHFIRHH6ct1pRBntUfzFYlCjf5KJ6nItOmg81flN5G qamL/I3mrcvrc61BIY5Suy1OCrSkZrF7wZ6oE+GqjBZgIbCA/O0yiwOvYquV5cRbUvrw XUsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s3Fc+rAd; 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 u4si6601577ejy.271.2021.09.10.05.41.34; Fri, 10 Sep 2021 05:41:58 -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=s3Fc+rAd; 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 S233558AbhIJMjD (ORCPT + 99 others); Fri, 10 Sep 2021 08:39:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:55194 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233730AbhIJMhQ (ORCPT ); Fri, 10 Sep 2021 08:37:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 235E76120A; Fri, 10 Sep 2021 12:35:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631277354; bh=u9zluEWB18JkYxp3OuvxqEPeLfuUjRgiLvaU6qfkzmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s3Fc+rAdo3auBt1AMAveYLMMb09xWrOO/0bxp0cBoi1U0pfz33AaxVB0ZlFvirIuq qTfNfK/cZDuhXAQvtoxmfZXy1JYmqxNZEzLuEhXjWgI/PpgExYW6KoOTcbFWVRduvw qkdo/t8UEqniSdof/1H214GcsprxXY8eNJ+StTFU= 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 5.4 21/37] media: stkwebcam: fix memory leak in stk_camera_probe Date: Fri, 10 Sep 2021 14:30:24 +0200 Message-Id: <20210910122917.862680130@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210910122917.149278545@linuxfoundation.org> References: <20210910122917.149278545@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 @@ -1346,7 +1346,7 @@ static int stk_camera_probe(struct usb_i if (!dev->isoc_ep) { pr_err("Could not find isoc-in endpoint\n"); err = -ENODEV; - goto error; + goto error_put; } dev->vsettings.palette = V4L2_PIX_FMT_RGB565; dev->vsettings.mode = MODE_VGA; @@ -1359,10 +1359,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);