Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp655173imu; Fri, 25 Jan 2019 08:37:55 -0800 (PST) X-Google-Smtp-Source: ALg8bN58bnwBk79byrCaVUhbitAqmOnsq2DD00Ueg/7ONhHYXDnQeeO9q8+ydBKPauhpdcLHBwPI X-Received: by 2002:a17:902:6a4:: with SMTP id 33mr11418337plh.99.1548434274932; Fri, 25 Jan 2019 08:37:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548434274; cv=none; d=google.com; s=arc-20160816; b=R81gmIG2+u+vXjEaMYRC+2OfFBhHBFFVrlEB0cBYezOaFj/Dn12cqK3b8Qr+Z8iRNz 5SP8Hk3UlhT+94ByCneVElOSzNK3uEix2HVqP5khyjv3NRzI6D/PFQLAIMxPcdh+CmTc nLWI5NddmGDiwZyzDJNESEeEAEcxE5fkgekSq7mIYwSY8nVFZ9hnYazD68BJH2Zc8gBl KR7uiHt2MvDk9C1BK1UVQH350MN0s4KoCxT7ryfIbuf7TCz9wYXcaO08ZcN4359mSO/Z QZeRI87d6Iu2BzTD97gAFrt8GoN+rxj6hrL6LC1d5INv/iZu9UwG8wgxVEgDgAxTncpi qqWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=e+BbgEkrrkWDs79/EBcXbQLkkPTCLRZTPqOGiMizwyE=; b=uK1NTFHwCJf3xDbLRQH/8LUWWpXhrQ9UTR0wTuUGEJzheQLnnkZaGYXUJ13J6jieZN 9L7QbmKMlsY9dgo9+IprDQK15df+Tm5GIf4wnxg+JaPzb2XgnNWNd7Zn9ihfTwL5EkMt kWirm5Wo8UQH0Lq+apf61VhMFHU+J/B13a2jA7QgS8F+1BjlHryO1vHXsakVgTpZpzmt OmnwUVJ8k2yQHd7bkVCX3HSDx+vkmIguyHqpRFoZfA/fTJkAC5kjtn6aZWgLEKxcjDhD b7RO7ljVmisJwiteIX+YROwk7d4sFLudxr3fYVOqoIwTGtaPd4pLWCf5CzX2bMV4TdlI vIUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=T5WYtgiL; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cd16si25975510plb.47.2019.01.25.08.37.39; Fri, 25 Jan 2019 08:37:54 -0800 (PST) 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=@ti.com header.s=ti-com-17Q1 header.b=T5WYtgiL; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728503AbfAYQhX (ORCPT + 99 others); Fri, 25 Jan 2019 11:37:23 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:56738 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726256AbfAYQhW (ORCPT ); Fri, 25 Jan 2019 11:37:22 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x0PGb7k1025075; Fri, 25 Jan 2019 10:37:07 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1548434227; bh=e+BbgEkrrkWDs79/EBcXbQLkkPTCLRZTPqOGiMizwyE=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=T5WYtgiLLu6oIFP13YBvIm/5Hbj4AjOOsam8Oj5EuAMgGabDleEvLenpqTlqhgO23 ws2LaGY70wpBRGoDWsWWi7SVSP1MGmemGBgC6jBHu8KOxQ16mxqyisnERWLbNEvLcx zXu5pZlpapGf0zesgC+jn3KYaXCemft6VMP7l8dI= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x0PGb7hl119280 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 25 Jan 2019 10:37:07 -0600 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Fri, 25 Jan 2019 10:37:06 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Fri, 25 Jan 2019 10:37:06 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id x0PGb6pS008030; Fri, 25 Jan 2019 10:37:06 -0600 Date: Fri, 25 Jan 2019 10:37:06 -0600 From: Bin Liu To: "Matwey V. Kornilov" CC: Greg Kroah-Hartman , , "open list:MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER" , open list Subject: Re: [PATCH] usb: musb: Fix potential NULL dereference Message-ID: <20190125163706.GI18982@uda0271908> Mail-Followup-To: Bin Liu , "Matwey V. Kornilov" , Greg Kroah-Hartman , matwey.kornilov@gmail.com, "open list:MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER" , open list References: <20190123175142.12604-1-matwey@sai.msu.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20190123175142.12604-1-matwey@sai.msu.ru> User-Agent: Mutt/1.5.21 (2010-09-15) X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 23, 2019 at 08:51:42PM +0300, Matwey V. Kornilov wrote: > We assign "urb->hcpriv = qh;" a few lines down. The valid qh for the urb is > hep->hcpriv in this code path. > > Fixes: 714bc5ef3eda ("musb: potential use after free") > Signed-off-by: Matwey V. Kornilov > --- > drivers/usb/musb/musb_host.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c > index c6118a962d37..6f267716768e 100644 > --- a/drivers/usb/musb/musb_host.c > +++ b/drivers/usb/musb/musb_host.c > @@ -2336,7 +2336,7 @@ static int musb_urb_enqueue( > * odd, rare, error prone, but legal. > */ > kfree(qh); > - qh = NULL; > + qh = hep->hcpriv; > ret = 0; > } else > ret = musb_schedule(musb, qh, Did you run into any issue? The original code seems to be correct to me. Regards, -Bin.