Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp345441ybj; Wed, 6 May 2020 19:33:44 -0700 (PDT) X-Google-Smtp-Source: APiQypJlH/rwMRW2JOWnl3hhXmEKsQ07gOa5GPEKcCk16TBRYb7GEfzplPMdBtq0MLfkb5L1K2SV X-Received: by 2002:a05:6402:391:: with SMTP id o17mr9935123edv.71.1588818824703; Wed, 06 May 2020 19:33:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588818824; cv=none; d=google.com; s=arc-20160816; b=qAgpE4cM2I/Vz8+hDLLRDsnDkSwr92kxEfP63uY7M7bc1xOdzC/AaLY++p/xBJZNad Tw6Fkoz0Y5UXHHMnK5I3kxdP4XvXFSaUtGgFMHse47v5qvIvGYuU4Mk5lRBlrb3Fnjmx j4V8/PhPBLP1r0330lPw5X324GYqHgQNfpq8B3KwXVtUQcQCvQWFLGwsiQ4bAweaCovL WZTXJljohq7GWW0Tb0Blw3jjxMEoGNMBEM4fe4XAdvYMJoBdWnxNNEkMNrECbH6CxgB+ xfgXidHl2cJWw4gXFRktH87FMG7Tq04Mza7r7pKsbKwkNNPTpSa2biVbUX1DOwO9t1UV 5DUw== 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=BFcElvh61etbVF9tfpBdfRaJKC0W5OReobs0RcNn0qw=; b=1GFW1CM7gH2U/udcx9agB1t1qzK4tjRH1NdHe+BVV8ilBMFVK3PeGZZ1ridDxqhpRE pXij/cdJ7ke5O+HeEZsEbKMQM3g+taAwJc5Y8a1htLEMH+ObBYAEIEISt888CTKvsP+0 k/RmxQ1ZpCNvZjtZb1QRGFv9dIFeqZrnl09Fo1VqcT5Rb7AgdSObq9B9Q9MYZ+wNwPC6 GLBM8LmObG14TxDWLxZnDcW0GygXXqztZCVxvN2iMlI5cUuKNAm97c8SgZzABw4MxtP4 i45I1aVaLGyuQIV0VaOfCQWlHklNtjzyAinr3ycU5LeN+vlPpudGiGezptpq6eS6+emi thVQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v2si2113474edx.112.2020.05.06.19.33.21; Wed, 06 May 2020 19:33:44 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728296AbgEFUJZ (ORCPT + 99 others); Wed, 6 May 2020 16:09:25 -0400 Received: from netrider.rowland.org ([192.131.102.5]:39241 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1728166AbgEFUJZ (ORCPT ); Wed, 6 May 2020 16:09:25 -0400 Received: (qmail 17008 invoked by uid 500); 6 May 2020 16:09:24 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 6 May 2020 16:09:24 -0400 Date: Wed, 6 May 2020 16:09:24 -0400 (EDT) From: Alan Stern X-X-Sender: stern@netrider.rowland.org To: Pete Zaitcev cc: Oliver Neukum , syzbot , , , , , Subject: Re: KASAN: use-after-free Read in usblp_bulk_read In-Reply-To: <20200506114732.5f81c8c5@suzdal.zaitcev.lan> 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 On Wed, 6 May 2020, Pete Zaitcev wrote: > On Wed, 06 May 2020 11:14:42 +0200 > Oliver Neukum wrote: > > > Very well. We are not going to find it without exceptional luck. Yet > > there may be a real issue, too. We simply do not know. How about the > > attached patch? > > > usblp_unlink_urbs(usblp); > > mutex_unlock(&usblp->mut); > > + usb_poison_anchored_urbs(&usblp->urbs); > > > > if (!usblp->used) > > usblp_cleanup(usblp); > > This can't be right. Our URBs are freed by the callback, and this > technique is not compatible with poisoning, at least with how the > usb/core.c implements it. The usb_poison_urb() waits for URB > to complete, and if the callback frees it, it's a problem. That's not a problem. URBs are reference-counted, and usb_poison_anchored_urbs() does usb_get_urb() before and usb_put_urb() after calling usb_poison_urb(). Alan Stern