Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp712312pxv; Thu, 15 Jul 2021 14:10:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyv05AaPTm0Lo+3uT4ZD8B3TXpDhhqSoKTYkytw5yccyWzXxryXeQC4rb1DuOH/9jHdJ7h8 X-Received: by 2002:aa7:c6d4:: with SMTP id b20mr9639383eds.204.1626383440947; Thu, 15 Jul 2021 14:10:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626383440; cv=none; d=google.com; s=arc-20160816; b=vDHuKqIzNCqM5ipQPPkoHiB+rdrnNxHe9i2qNgXsgDTvhGLAa3uVR3pprtrLayIt+9 7g2dFFwqoWm5+dAWTe+Uaucp/RJ7x0OwIslI51yT4bGG1ZWZ4emsCYksK2XBl7HH3x2O Yx+6KfHBVrP4PWG2NabcgQBkHjY5iX6OwYLZx1U22CDrIfVh+YNW/zghJ3CtdjrsEEJm jkGpUU6YTeJ0EPO5/Ns3S6R2sYPJIiyE+4gqIpzeopZWDl1f+a+Xr2psmRASjovtQwGT 8yuNKXguVsoycMk1ig2oIH15Sspd0qtfnFbAHKWR4PqJwCeiHoXQFOSj+roy9hjAgUKP IfVw== 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=j4aiUv78Co9dlnnf0FftTmimu7aKHj6IXyG0WELg8Rc=; b=yPy6s8aKmw/+iUEWti2BcAynr2/5jpjZ2wOoy2opWfqKCjdhyBOTzReQhcq4eTriN4 HccsI2lSwU2qjHJIPRB4RmTzKoyl9VwS3HFAz76HjZZ6VsDtKlLTf+Xo0MIMX18zZCwv LP60G7lbFeAWI7d/cfrCb5OmKT+ZmkLMRJQmROkdPCEPuRtXuVoEf6n0yZQaZul1c3GF NQbgInFjEyOKrAMnNZsjlq/0quubC9Y+UTnfdIhrQJbtUKCcedR7Zv4k0VmzOvHz5dQ2 LrVB7ZU5mR4oLL043w6sczS8x1QOS//wyRvGHCgHAPh6MOnZg38VlZqjQao5S/DwXwxp KzWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QRkDwg8p; 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 j5si8283849ejs.749.2021.07.15.14.10.17; Thu, 15 Jul 2021 14:10:40 -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=QRkDwg8p; 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 S244612AbhGOTW5 (ORCPT + 99 others); Thu, 15 Jul 2021 15:22:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:45710 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242775AbhGOTGX (ORCPT ); Thu, 15 Jul 2021 15:06:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 313D5613DF; Thu, 15 Jul 2021 19:02:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375759; bh=2HI+/sRWXFFVhfZRSSABrrORznPJcyMpA1UMZaKJhBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QRkDwg8pwplLMdTFoCh3XVIfMtdWoIhi45euPwhHX2aB95nhxy67kqQyJO0I96Mh8 V3oP/8DGWFNJvtu5Jpwj+vZEVCgtOClKI1qDkEbcmNURIE9jrkFv/1UWWVRA0sMmRG +E33Dy92IcPmpq5rzKL+H140+28d4KAXk9I3wxqI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+af4fa391ef18efdd5f69@syzkaller.appspotmail.com, Pavel Skripkin , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.12 224/242] media: zr364xx: fix memory leak in zr364xx_start_readpipe Date: Thu, 15 Jul 2021 20:39:46 +0200 Message-Id: <20210715182632.381864812@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@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 0a045eac8d0427b64577a24d74bb8347c905ac65 upstream. syzbot reported memory leak in zr364xx driver. The problem was in non-freed urb in case of usb_submit_urb() fail. backtrace: [] kmalloc include/linux/slab.h:561 [inline] [] usb_alloc_urb+0x66/0xe0 drivers/usb/core/urb.c:74 [] zr364xx_start_readpipe+0x78/0x130 drivers/media/usb/zr364xx/zr364xx.c:1022 [] zr364xx_board_init drivers/media/usb/zr364xx/zr364xx.c:1383 [inline] [] zr364xx_probe+0x6a3/0x851 drivers/media/usb/zr364xx/zr364xx.c:1516 [] usb_probe_interface+0x177/0x370 drivers/usb/core/driver.c:396 [] really_probe+0x159/0x500 drivers/base/dd.c:576 Fixes: ccbf035ae5de ("V4L/DVB (12278): zr364xx: implement V4L2_CAP_STREAMING") Cc: stable@vger.kernel.org Reported-by: syzbot+af4fa391ef18efdd5f69@syzkaller.appspotmail.com 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/zr364xx/zr364xx.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/media/usb/zr364xx/zr364xx.c +++ b/drivers/media/usb/zr364xx/zr364xx.c @@ -1032,6 +1032,7 @@ static int zr364xx_start_readpipe(struct DBG("submitting URB %p\n", pipe_info->stream_urb); retval = usb_submit_urb(pipe_info->stream_urb, GFP_KERNEL); if (retval) { + usb_free_urb(pipe_info->stream_urb); printk(KERN_ERR KBUILD_MODNAME ": start read pipe failed\n"); return retval; }