Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp5542209ybh; Wed, 7 Aug 2019 07:39:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXDBowoxjGqaWZ1W6N0CfEPZKZuvC6pPa2HgfMG1c7h/QqRRTIX/fCK0nZROcOopu5g+O8 X-Received: by 2002:a17:902:346:: with SMTP id 64mr242690pld.151.1565188760346; Wed, 07 Aug 2019 07:39:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565188760; cv=none; d=google.com; s=arc-20160816; b=wB7ZiZ65yap/T0irOK4AKq3+ZY3mHuLF5h1Gldk3xffcpXa4GnZ3HqL3+/oaD40pFF DmZQadBujUVj5AmXmW5U8YD0HN7vGMVyo+UPw3Rr+wUYHZ/KdGZF+xL9Q+GZLilWkF9j r+IwLBDpNzVNLlwxjjBYNG4/MbHelG8iznyZurY4MN+DpTl/qa2SmDItCcqj40vBDuXG 8niIfDIqL+DsOvs9DJxxXtWXgfITGY+XD7aXivrrWT3tLgJify077+rUV/ByvsSwioLS bEq8TiWeXWrKJodEYzRv5YtEzYuJMWbXS3BKq0NHVHQc/Ay4tsfKA5d0K66kkaFzRi05 EWOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=yQlvUqDQSwtjqRHZDerAho62VR8VLBGxeeMFjPkaYDI=; b=welUXRFuyOaEzWJVDuH3f+2wtHexITs98+I/qTzjoz55w4DvduD+/iwaNCBgAwovzT bOYop2Th1qpMkgUcAjWXkoa5y1fGZZCOaQ8Gw1fYhD3RMj6F9/luXyej08rXkDjv9SqM fpwgI8qkjxzaIpAnkO+T3yKe7glpH7J0XJhFmtqSVS6ffK9jnfzN7xUfXQKCMVcAESVg LzNJaI+gbto0rmYKK/E9H5CUD3V0d1i8+Asoeo+DzrqIslH6UfGqgrONOxJkhyNhywC+ 82GaUfurPoxDT4fG1HT9VLBN+PDiZ6XAeDrXM+068qNxS+/ZEbtzEJxh9+ICXE6lfEjg 1Mwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RImjVD16; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k14si83912pjq.53.2019.08.07.07.39.05; Wed, 07 Aug 2019 07:39:20 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=RImjVD16; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388554AbfHGNo4 (ORCPT + 99 others); Wed, 7 Aug 2019 09:44:56 -0400 Received: from mail-pl1-f172.google.com ([209.85.214.172]:33902 "EHLO mail-pl1-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388402AbfHGNoz (ORCPT ); Wed, 7 Aug 2019 09:44:55 -0400 Received: by mail-pl1-f172.google.com with SMTP id i2so40930757plt.1 for ; Wed, 07 Aug 2019 06:44:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yQlvUqDQSwtjqRHZDerAho62VR8VLBGxeeMFjPkaYDI=; b=RImjVD163mr6RcC+8MieyiTg920KcYSztgLE6WaTLvkei/6EO9EGgiR1VPzF70x1P9 iyQVbEL8oPyalAbDtXfOtOdNKblWiGZ8RhW3bpdPz4oB2dEKHnGmHtyKDlGWndczp2Bm ta1r4hkCebP8MqvMLaUBT9DY2lW/GTfcZgtlVYYHeh5jykdoxSOhCgVGGvwILEDe92iy tRB+bbKKEfyFoM4YqVe2uVwL9DulQTMNPy5knRO0Wf+QdpA52lUA3iuPJbmhFAEDUjZE 75FiTv9cZWiWimaZXTZX+dOUr5P9w5BncaChXu1iM/BHJNZtBeGOZ4nVEglnAcn0DCU8 lVNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yQlvUqDQSwtjqRHZDerAho62VR8VLBGxeeMFjPkaYDI=; b=UFFxIV5dv3oS7qbVDkqgNDF86ffWjliT5PRVDTDKqq3TSQvd1u1L5rjKmzK2uEV8tS jXuJRpPvLYAbFz6KX3jtXvKoVctROjVdY9tSCwwgUiKrw9BqO7Sv+kdXG7JrdoQvLGq5 YpXBZBY4y/gH5X9E+2yb6TgCcKHQlhaco39baBTXLB6v5h8ybOUjzeAuqY2E0LREkzG7 ofNoBwr8px+aEsv28Ws1myfCBrhkWCVA533GDL3HdldXhtTFQJm1+0AF8YM1Cd+eY5h5 0WHrGDsWWtRxEkP1Yqx5JA5WF7EFQmbbWSKwVCkSxI4VOOZLveMevkUMZGCSGRj+tLCf Vztw== X-Gm-Message-State: APjAAAW5Bcrp+/v1nLJgOcScY9QZ3usqJgmFJYP0058CN0ic63oiisY4 RfE3via2I2nxnoDLUUC1G6NFXkD4wF3VyUwkBewjKg== X-Received: by 2002:a17:902:6a87:: with SMTP id n7mr8105236plk.336.1565185494893; Wed, 07 Aug 2019 06:44:54 -0700 (PDT) MIME-Version: 1.0 References: <1565095011.8136.20.camel@suse.com> <1565185131.15973.1.camel@suse.com> In-Reply-To: From: Andrey Konovalov Date: Wed, 7 Aug 2019 15:44:43 +0200 Message-ID: Subject: Re: KASAN: use-after-free Read in device_release_driver_internal To: Oliver Neukum , syzbot Cc: syzkaller-bugs , Alan Stern , LKML , USB list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 7, 2019 at 3:44 PM Andrey Konovalov wrote: > > On Wed, Aug 7, 2019 at 3:38 PM Oliver Neukum wrote: > > > > Am Dienstag, den 06.08.2019, 14:50 +0200 schrieb Andrey Konovalov: > > > On Tue, Aug 6, 2019 at 2:36 PM 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. > > > > > > > > If you agree. I am attaching a putative fix. > > > > > > Let's see if it fixes the issue. > > > > > > #syz fix: https://github.com/google/kasan.git 6a3599ce > > > > Hi, > > > > did this ever produce a result? I saw none. > > Hm, that's weird, maybe that's caused by putting the bot into CC. Let > me try that again. > > #syz fix: https://github.com/google/kasan.git 6a3599ce Oh, wait, it should be syz test =) #syz test: https://github.com/google/kasan.git 6a3599ce > > > > > Regards > > Oliver > > > > -- > > You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group. > > To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-bugs+unsubscribe@googlegroups.com. > > To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/1565185131.15973.1.camel%40suse.com.