Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp425690pxy; Thu, 22 Apr 2021 05:28:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxepyEg5rHKIMnZVrbATGcsieGTU87/DQFZBZxOcMTaQ51UgOT9Vd64Scw1tS/eOlPcbXq5 X-Received: by 2002:a17:907:c10:: with SMTP id ga16mr3053844ejc.402.1619094510336; Thu, 22 Apr 2021 05:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619094510; cv=none; d=google.com; s=arc-20160816; b=LPj1FvQq0vZInvFz8cNaQSDfRwS+aGXM+OYuYz713qDd7MOWalBcE+XlHZlTorh/pa erVJ0qVIGI5TXsqEhsW95DsaXM/nwLhQFiv3xcIAS7kbl+LeVOPTXKbFuAS01Wq8HSTf wI1DJXNug1Hm/Gqb6ipvl7RXLI1m2zGGmKOr71et/L2+Nf3k31K0Tya5xD1gSL52N3Ie 7gAFO53Q8xZ5Rkacu3zIyhFtB2+A0qHQLdWhU5Il0zz1a0LMJcYQYnrEsNAe9Be8mFu1 yA5RsTcumyUEYBrh+iVC0Hy0OEgjVx0ye3HkUGQWIhr2UsEzWxsq9RCHz0WVEdtdbkWu g/wA== 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:date:to:from:subject:message-id :dkim-signature; bh=RECEfsZBNRjYNvlSSaCaXHoBXSmE5X3WtOQeZ0cdsQk=; b=Psay0/RCp9fFgCoz0oIE3RmVxep5zNSn91vLoVB1rHaq9JpVvDjnIH38fNuvSzNjCs SeOcPsGzyZQAgEzLzqOO7neY9jjPPr/dHPAa2FVl46zWbw77t01UMYxRz9T4V3n43IDj TSuNKC+Ohyf0MVP/IcBI5FQPFn8ri6Ygp7aIX9FOd4x4tmDLNnDl7geI0eLsU+NcwI8l Gj1yE5AiJr98f7Dk0Y+Y9YYYR2pbkJ3oeDm/qsUzQbdDVO0qnjzicbpSYJ+O9lNKJokv mEZm2snXu79af0KZTvLcyvE6rxJtsnqDze3MSQoeG/2LlLjexFaVNlzw/8gvtGguUs+4 zShw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=JCJpJNqg; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r1si2037790edp.303.2021.04.22.05.28.07; Thu, 22 Apr 2021 05:28:30 -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=@suse.com header.s=susede1 header.b=JCJpJNqg; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236124AbhDVM1g (ORCPT + 99 others); Thu, 22 Apr 2021 08:27:36 -0400 Received: from mx2.suse.de ([195.135.220.15]:46752 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236008AbhDVM1f (ORCPT ); Thu, 22 Apr 2021 08:27:35 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619094420; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RECEfsZBNRjYNvlSSaCaXHoBXSmE5X3WtOQeZ0cdsQk=; b=JCJpJNqgbl436K8JGv5cMckSpbcM2e7aw1prytkAxI81R1PpNJRbDJQwVcvVrexN6TJ3Uu VQOsBqdrCmhULF9i5Aoi1gEsDefDb56uRLG4EdlsIyyV2btyHgrjijnX/7+ekCk65Ovt2Y 0zhuqYJoMiv0rdbGPHG+OdQazkiuDzk= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 50D60AF1E; Thu, 22 Apr 2021 12:27:00 +0000 (UTC) Message-ID: <94aa3e7fcbb225da66961a21c940406ada2bbd0b.camel@suse.com> Subject: Re: [syzbot] memory leak in usb_set_configuration (2) From: Oliver Neukum To: syzbot , gregkh@linuxfoundation.org, johan@kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, mathias.nyman@linux.intel.com, stern@rowland.harvard.edu, syzkaller-bugs@googlegroups.com Date: Thu, 22 Apr 2021 14:26:42 +0200 In-Reply-To: <0000000000001ad5d605c07cfd2e@google.com> References: <0000000000001ad5d605c07cfd2e@google.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Mittwoch, den 21.04.2021, 08:12 -0700 schrieb syzbot: > Hello, > > syzbot found the following issue on: > > HEAD commit: 9cdbf646 Merge tag 'io_uring-5.12-2021-04-16' of git://git.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=136ce5a6d00000 > kernel config: https://syzkaller.appspot.com/x/.config?x=fd35e661e44323ea > dashboard link: https://syzkaller.appspot.com/bug?extid=d1e69c888f0d3866ead4 > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16ecba29d00000 > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=143cf955d00000 > > IMPORTANT: if you fix the issue, please add the following tag to the commit: > Reported-by: syzbot+d1e69c888f0d3866ead4@syzkaller.appspotmail.com #syz test: https://github.com/google/kasan.git 9cdbf646 From 1704504f905fe8e3eb83d63cbbbe9af60f002585 Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Thu, 22 Apr 2021 14:14:21 +0200 Subject: [PATCH] cpia2: unregister device on probe error The v4l2 device must be unregistered in case probe() fails, lest we get a leak. Signed-off-by: Oliver Neukum --- drivers/media/usb/cpia2/cpia2_usb.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/cpia2/cpia2_usb.c b/drivers/media/usb/cpia2/cpia2_usb.c index 3ab80a7b4498..db3b5d6d2d9a 100644 --- a/drivers/media/usb/cpia2/cpia2_usb.c +++ b/drivers/media/usb/cpia2/cpia2_usb.c @@ -844,15 +844,13 @@ static int cpia2_usb_probe(struct usb_interface *intf, ret = set_alternate(cam, USBIF_CMDONLY); if (ret < 0) { ERR("%s: usb_set_interface error (ret = %d)\n", __func__, ret); - kfree(cam); - return ret; + goto error; } if((ret = cpia2_init_camera(cam)) < 0) { ERR("%s: failed to initialize cpia2 camera (ret = %d)\n", __func__, ret); - kfree(cam); - return ret; + goto error; } LOG(" CPiA Version: %d.%02d (%d.%d)\n", cam->params.version.firmware_revision_hi, @@ -872,11 +870,14 @@ static int cpia2_usb_probe(struct usb_interface *intf, ret = cpia2_register_camera(cam); if (ret < 0) { ERR("%s: Failed to register cpia2 camera (ret = %d)\n", __func__, ret); - kfree(cam); - return ret; + goto error; } return 0; +error: + v4l2_device_unregister(&cam->v4l2_dev); + kfree(cam); + return ret; } /****************************************************************************** -- 2.26.2