Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp4173237ybh; Tue, 6 Aug 2019 07:27:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwoefmrRPCILJdIVz+hHSRQ1gd7elsZIUtKF3n6RRoJioiiWTSj/kQESb3XVSvqNjfDl24A X-Received: by 2002:a65:52c5:: with SMTP id z5mr3333139pgp.118.1565101632774; Tue, 06 Aug 2019 07:27:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565101632; cv=none; d=google.com; s=arc-20160816; b=XvwE5Cl6XlriPipPL+R2/cO0Kqqxkgf58yCybE00L3zWrhcx9w4Hwl4cCll2UiaQlR oHOHWfRrjLR+C0maYRYCPFhQPFnnVJ+pqKWESWUua5CgevAK1dB3R76lJUpL8O0FEblo +F7lyK8Vn0zDGaH898sasykt2fNqW5cb6lRS21Tgx7gKmLq5s1rvfW6p1JCUdGUBUH4n +d3SOm63mTU2wRxOIA2QUcRKEmGZutRwRERE22P1ofltAlgJs1IHIgZVXLgqGtRpwsd6 ias7XbmdoQpLOpJttA8nxl4VNBYW1LzkAEcAjW4mDsrYvZVEB1AKPkXHs6ek3isbhYdz L1Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=fm8LaT8pEkdj/Z0++6tEoerNL6eL/6cKpwpsJHwENTE=; b=ix4NfxF/lqQbAS/sovjUo3lglGawj5V2CgVlGiNlKDgDCgoZDc82hbCrp17phnSK0n ecqaOAcHgPwDA0kka5WtaeOR85xJZYT5XufgfLeWhzhKMkiEHr/2iTyDmx0vAdygw99+ zd8Ewd0QzSPpGqTCAy8AN6/i3xoYrSilTLy/jyLp8thrlJc8PHCEtjRgA4oqdULO6Qiz W7E2ewRqzyRUmkQAAldrtY+plvHHSpBG0GS8Yy9u3ouMw2SvfV+rHaJikq5lD3CsPiww 40QyxTrycUdL3/vgHFmkScncDUyPBvV+TFmKJIaLeYLYNoiNTW0aWASHDLYcKxUURexi BW7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l15si131920pjq.104.2019.08.06.07.26.57; Tue, 06 Aug 2019 07:27:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732883AbfHFO0G (ORCPT + 99 others); Tue, 6 Aug 2019 10:26:06 -0400 Received: from mx2.suse.de ([195.135.220.15]:57968 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728756AbfHFO0G (ORCPT ); Tue, 6 Aug 2019 10:26:06 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B89FCAC1C; Tue, 6 Aug 2019 14:26:04 +0000 (UTC) Message-ID: <1565101558.8136.30.camel@suse.com> Subject: Re: KASAN: use-after-free Read in device_release_driver_internal From: Oliver Neukum To: Alan Stern Cc: Andrey Konovalov , syzkaller-bugs , syzbot , LKML , USB list Date: Tue, 06 Aug 2019 16:25:58 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Dienstag, den 06.08.2019, 10:19 -0400 schrieb Alan Stern: > On Tue, 6 Aug 2019, Oliver Neukum wrote: > > > Am Donnerstag, den 01.08.2019, 14:47 -0400 schrieb Alan Stern: > > > > > > I think this must be caused by an unbalanced refcount. That is, > > > something must drop one more reference to the device than it takes. > > > That would explain why the invalid access occurs inside a single > > > bus_remove_device() call, between the klist_del() and > > > device_release_driver(). > > > > > > The kernel log indicates that the device was probed by rndis_wlan, > > > rndis_host, and cdc_acm, all of which got errors because of the > > > device's bogus descriptors. Probably one of them is messing up the > > > refcount. > > > > Hi, > > > > you made me look at cdc-acm. I suspect > > > > cae2bc768d176bfbdad7035bbcc3cdc973eb7984 ("usb: cdc-acm: Decrement tty port's refcount if probe() fail") > > > > is buggy decrementing the refcount on the interface in destroy() > > even before the refcount is increased. > > > > Unfortunately I cannot tell from the bug report how many and which > > interfaces the emulated test device has. Hence it is unclear to me, > > when exactly probe() would fail cdc-acm. > > Only one interface (numbered 234!). Yes. cdc-acm went into the look_for_collapsed_interface code path. But I cannot tell whether it proceeded to made_compressed_probe (Yes, I know the code makes extensive use of "goto") > > If you agree. I am attaching a putative fix. > > Your patch adds a line saying: > > > + usb_get_intf(acm->control); /* undone in destroy() */ > > but I don't see any destroy() function in that source file. Did you > mean acm_port_destruct()? Yes, sorry > In any case, I don't know if this missing "get" would cause the > problem, but it might well. Then let's wait for the result. Regards Oliver