Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4131054ybl; Tue, 20 Aug 2019 07:26:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzI08+isYm1hZcs+HqLpnG65QRc2z9JY4h6eW2YflcWOQosyXcNDHsTE4KrL+NNCmIii3/h X-Received: by 2002:a17:90a:23c5:: with SMTP id g63mr280571pje.124.1566311188442; Tue, 20 Aug 2019 07:26:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566311188; cv=none; d=google.com; s=arc-20160816; b=YZXr0KbSelFqlGI/TPWdxz94EesKG3HCkmKneZ6u/ISTCVyOA19XWMCR54EJ08LAco eo/JdT9Pu+aQpbD90yMesC2wGEmcEh6mF9Jkm36vUy7BJxPG/W9sulh8r1BTferYgU1P k7gnYCnkwhcrtuMBfCIUoqwGB9Kxe0n3PM+M+RoUBmA5NQSbwCb2TdZFXRNEpgZv8oUJ KLUJ09GYAPM5/G4RMN99OXzYq2LzpvI0Das7EqHPkuiZ0r7Tl9SKDQS0QJ9kA2Co8TXB vERci8vNLMJFUxz9YgqJ8pWwNQlfGVqlDF2SloclonM/i1Qi8eeNLHP4YqezQlIEsAXF DCLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=tusVWvn3Oz3/KR0LPyhdIgwnDtd1clnfuA+1beQTqc4=; b=QYEPxOmketZrGkUy591j4foTfv0QkO/YJHXsHMsubE/2wEPjE47R2TkLfCE7XpIMFG XqHKlXy/G9yDJ2dVNmRaSPfRcWUmnqsZMiER/+jK91giASVfeMYIT02zsh118+xVR592 IsgX+WBQJTR9RiROvYD6aO2dH89k/vpT+Gy1T9KPvh97VCD3erPmsNuXo82sgZbcnEhA /Igm0NKiprFwGVRLWCc/tjsRmW3qvK13TmapID5+sdUW43lkROqHDfR+u0B5G3rBIPI9 6xcC1UWEVE/pvE22HqMWPIOheVY4shZlef6HJHin4JF/arO5PPlfUcnAEy7Y12AXuxbb QPgg== 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 d8si8064557pls.0.2019.08.20.07.26.12; Tue, 20 Aug 2019 07:26:28 -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 S1730030AbfHTOYC (ORCPT + 99 others); Tue, 20 Aug 2019 10:24:02 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:36036 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1729137AbfHTOYC (ORCPT ); Tue, 20 Aug 2019 10:24:02 -0400 Received: (qmail 2525 invoked by uid 2102); 20 Aug 2019 10:24:01 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 20 Aug 2019 10:24:01 -0400 Date: Tue, 20 Aug 2019 10:24:01 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Oliver Neukum cc: syzbot , , , , , , , Subject: Re: KASAN: use-after-free Read in iowarrior_disconnect In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Oops, I replied to the wrong email message -- sorry. This was intended to be about the problem with the yurex driver, not the iowarrior driver. Alan Stern On Tue, 20 Aug 2019, Alan Stern wrote: > On Mon, 19 Aug 2019, Oliver Neukum wrote: > > > Am Montag, den 19.08.2019, 07:48 -0700 schrieb syzbot: > > > Hello, > > > > > > syzbot found the following crash on: > > > > > > HEAD commit: d0847550 usb-fuzzer: main usb gadget fuzzer driver > > > git tree: https://github.com/google/kasan.git usb-fuzzer > > > console output: https://syzkaller.appspot.com/x/log.txt?x=139be302600000 > > > kernel config: https://syzkaller.appspot.com/x/.config?x=dbc9c80cc095da19 > > > dashboard link: https://syzkaller.appspot.com/bug?extid=cfe6d93e0abab9a0de05 > > > compiler: gcc (GCC) 9.0.0 20181231 (experimental) > > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12fe6b02600000 > > > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1548189c600000 > > > > > > IMPORTANT: if you fix the bug, please add the following tag to the commit: > > > Reported-by: syzbot+cfe6d93e0abab9a0de05@syzkaller.appspotmail.com > > > > > > > #syz test: https://github.com/google/kasan.git d0847550 > > There's no need for us to work at cross purposes on this. We can go > with your approach. > > However, the code is more complicated than your patch accounts for. > The wait can finish in several different ways: > > (1) The control URB succeeds and the interrupt URB gets an > acknowledgment. > > (2) The control URB completes with an error. > > (3) The wait times out. > > (4) A disconnect occurs. > > Your patch doesn't handle cases (1) and (3). (And it doesn't get rid > of the dev->waitq field, which is no longer used.) > > In fact, (1) is a little ambiguous. When the interrupt URB gets a > command acknowledgment, there's no way (as far as I can tell) to know > which command was acknowledged -- particularly if a prior command URB > had to be cancelled because it timed out. > > And as it turns out, the driver neglects to kill the command URB in > case (3). Furthermore, the driver doesn't have mutual exclusion for > writes. So there's nothing to prevent the command URB from being > submitted while it is still active (syzbot's new crash). > > I have to wonder if anybody's actually using this driver. It seems to > be pretty broken. Maybe we should just mark it as such and forget > about fixing it. > > Alan Stern