Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1839597pxb; Mon, 13 Sep 2021 06:41:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXhoje0+yK6YfLpUWItFN9n7YnLnQpcPJTTfu7Ti/tLATwsZndiKFkgHjXxKqAYtth20+4 X-Received: by 2002:a02:620e:: with SMTP id d14mr9549517jac.91.1631540499063; Mon, 13 Sep 2021 06:41:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631540499; cv=none; d=google.com; s=arc-20160816; b=sTjDLT+3LMX8mzxv/p/PBF/ToAN+m4g7FVmX+0wtjAY2zHyHv/xKhokfc4K5Y1JPNj 8l90AX7qpOlm2VGRL/64K1lqrABKu5Z5Z31Y/hSEFQi9mlVorBwfNIMjuJ29eVI1C5QV XWvrMcyo3ev2SsziH2di+ugCDvy3+LSxNjhDGCeGckOX63zIvjQteUHYuiDZgS6T7Ndf c7p0LNFvkaPRBRv9ATQqdkj9kkf+XKORznb1wBVsElatsh1ZZPJ8v4+Uc2/bVC14c0IK LS0a0mOknlb3dvduSDLnivyveSNA7SeFpnL/vsG1mh9sd7Zg2Xr9L8hmHfvdPxk2f5g2 ms9Q== 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=aVaIFvcXU0BmF9fZfUK0i/YOorpzahlmOIDeh3deJxk=; b=uCz9c8rL9SUQpdQS9B/dDeT01C5U3qRt2xccQyntfmoSe98ToUV++7pdehU9duqahB Sq6DRiBfNirb5PrhhtcmJ1CwzP2zwsRv2jABaH0GjV3yN0BP50u9xNuK0sCRqhzd0Isp opEWJah/z3/iab7KR0yNgH3tFNLmeg7qTYoDoNSJ2wBHqcWCC17AHCbFYyo6Z6sh1fUB XPmaDuU0p3zvo1/4AubJrHc7LaqtGU23naNOd8wNwMgZFeVPiHhVEtSOVAp0qNR7uOHh CuCl47Xm2Sz2muB0ZgqSM27aAujPZ8ZFqhn3sFVXVWz03ve5IlTQw3iOZxJora6jjjmN eCkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GSJ5yH+2; 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 e11si6825436ili.46.2021.09.13.06.41.23; Mon, 13 Sep 2021 06:41:39 -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=GSJ5yH+2; 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 S243743AbhIMNj7 (ORCPT + 99 others); Mon, 13 Sep 2021 09:39:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:33822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243069AbhIMNex (ORCPT ); Mon, 13 Sep 2021 09:34:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 593796124F; Mon, 13 Sep 2021 13:27:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539622; bh=+KgFxSgNdFkMVgeqQhxhH1KWHyahO0U7bjcVk1OwuGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GSJ5yH+2UTsYTGXenrEyPet7Xzbw3uXeGsWo7cuqByWNFQ8FOKpK14di/S1ObIeQ/ STNphiHDEHBeBkY7oTzjI+sCgqPhmlPv+cqh/DKYtIKbtVX8IM7O8SVdDn6yT7Ak7f DbuZW/c4QjsCnztyDGGB4Yv8g4aAMKIg+v89tya0= 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 , Sasha Levin Subject: [PATCH 5.10 094/236] media: go7007: fix memory leak in go7007_usb_probe Date: Mon, 13 Sep 2021 15:13:19 +0200 Message-Id: <20210913131103.555056633@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@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 [ Upstream commit 47d94dad8e64b2fc1d8f66ce7acf714f9462c60f ] In commit 137641287eb4 ("go7007: add sanity checking for endpoints") endpoint sanity check was introduced, but if check fails it simply returns with leaked pointers. Cutted log from my local syzbot instance: BUG: memory leak unreferenced object 0xffff8880209f0000 (size 8192): comm "kworker/0:4", pid 4916, jiffies 4295263583 (age 29.310s) hex dump (first 32 bytes): 30 b0 27 22 80 88 ff ff 75 73 62 2d 64 75 6d 6d 0.'"....usb-dumm 79 5f 68 63 64 2e 33 2d 31 00 00 00 00 00 00 00 y_hcd.3-1....... backtrace: [] kmalloc include/linux/slab.h:556 [inline] [] kzalloc include/linux/slab.h:686 [inline] [] go7007_alloc+0x46/0xb40 drivers/media/usb/go7007/go7007-driver.c:696 [] go7007_usb_probe+0x13e/0x2200 drivers/media/usb/go7007/go7007-usb.c:1114 [] usb_probe_interface+0x314/0x7f0 drivers/usb/core/driver.c:396 [] really_probe+0x291/0xf60 drivers/base/dd.c:576 BUG: memory leak unreferenced object 0xffff88801e2f2800 (size 512): comm "kworker/0:4", pid 4916, jiffies 4295263583 (age 29.310s) hex dump (first 32 bytes): 00 87 40 8a ff ff ff ff 00 00 00 00 00 00 00 00 ..@............. 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [] kmalloc include/linux/slab.h:556 [inline] [] kzalloc include/linux/slab.h:686 [inline] [] go7007_usb_probe+0x184/0x2200 drivers/media/usb/go7007/go7007-usb.c:1118 [] usb_probe_interface+0x314/0x7f0 drivers/usb/core/driver.c:396 [] really_probe+0x291/0xf60 drivers/base/dd.c:576 Fixes: 137641287eb4 ("go7007: add sanity checking for endpoints") Signed-off-by: Pavel Skripkin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/go7007/go7007-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/go7007/go7007-usb.c b/drivers/media/usb/go7007/go7007-usb.c index dbf0455d5d50..eeb85981e02b 100644 --- a/drivers/media/usb/go7007/go7007-usb.c +++ b/drivers/media/usb/go7007/go7007-usb.c @@ -1134,7 +1134,7 @@ static int go7007_usb_probe(struct usb_interface *intf, ep = usb->usbdev->ep_in[4]; if (!ep) - return -ENODEV; + goto allocfail; /* Allocate the URB and buffer for receiving incoming interrupts */ usb->intr_urb = usb_alloc_urb(0, GFP_KERNEL); -- 2.30.2