Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp664068pxv; Thu, 15 Jul 2021 12:51:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqLw8SYRGVxNCqDtQfstAj7vWJMtGWSJbdqtpTgW1yrWI6X0HU5XtvCD0QBWi6iTsJdpmC X-Received: by 2002:a02:b199:: with SMTP id t25mr5409819jah.35.1626378698363; Thu, 15 Jul 2021 12:51:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626378698; cv=none; d=google.com; s=arc-20160816; b=FYWvPbWj4FfF5UPNb20xqdVMch1RZU4Tvj6i1m7A8DrBA9Ke5L7/yUUNNdowQ86S8Q HvHHTLa+ldVnUq2xeMQs6VquoFFwfqmrIhbw/LrtMVMESVrL45Re3VvfC0Fb5XkbeA0T OyuUM94xaaUc207Am3js/s0I9wxGK+VamCMzN+bTOPW4GP3DutgzLDAaOKWRJYO4a+vH YvsccF0YfYyadcgNSMgLUSUvjgcNMkb+xm1qyhZ7Xv2rKfWWKQQO5GZoySNWL0rZzT5c nsqyeyFo9siFjxnx0DDS7y5W3pMzxsdDQo78QziAhOg+NGbTfLJBiCO9XLVb7pHBxxf2 /jsg== 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=mlVnHMrXXgUhvqZVTKWiQYkPDEE5I/D/ru+hqpa/rO0eSNs4ONCpfr4U4QRG6LWJkg Ek4jqoK6NJRUESNFKOHEZLU1hfRexk2be/X/xr3CD9Q/NhE5o2h5RWi/SqUth4ORvwWN V4twcRpmB+zkODigyNg0YPgNxXP+I8TqW283Dm+r/OPGLdOPeeDbRdIJJoi6uziAInhs RmHSlnAiBlZTgx+u+nrtkbo4rsfIx3Rh7ahNKCCkky6YIKVLFdzApEYVE1w2DbiBLvzg HiIwDO9yUUFDiFKmVuhtxwBVReDX9kQWxtCRP6tznRVLz68ZJq9K+YmuOqkX9Ay6M7aP wXAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Bc5D/i0c"; 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 h16si7729239ilc.129.2021.07.15.12.51.26; Thu, 15 Jul 2021 12:51:38 -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="Bc5D/i0c"; 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 S238855AbhGOTwe (ORCPT + 99 others); Thu, 15 Jul 2021 15:52:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:58956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242702AbhGOTSI (ORCPT ); Thu, 15 Jul 2021 15:18:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 00EE56140E; Thu, 15 Jul 2021 19:13:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626376388; bh=2HI+/sRWXFFVhfZRSSABrrORznPJcyMpA1UMZaKJhBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bc5D/i0c6z85jEcmCu3sanU3WHhfpt0B9oEp9skIDuLItLl+y6vY1KeDTyf0ZsY5j MLq1jqzR7Qx7YAhjkWLpMbcqaVacKgXxmVk1HYiQBP8g9pNoGKIfWDycxVJdm3e8tr Vm5yfFATPE0L91m0gdo0MbgrX3yFweXcFNUXr94s= 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.13 248/266] media: zr364xx: fix memory leak in zr364xx_start_readpipe Date: Thu, 15 Jul 2021 20:40:03 +0200 Message-Id: <20210715182651.864412428@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@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; }