Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2327931imu; Thu, 24 Jan 2019 10:49:24 -0800 (PST) X-Google-Smtp-Source: ALg8bN4+ahCBAfAMof76bG0WUgaaqlxsbxSC0ms4gmb5eFcAR2GtkPtXYeGmvVkLsnWtS6tdxLof X-Received: by 2002:a63:89c2:: with SMTP id v185mr6486885pgd.97.1548355763987; Thu, 24 Jan 2019 10:49:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548355763; cv=none; d=google.com; s=arc-20160816; b=NjhuLkzNpOVRtlhNVHWFJl4t2LgdT39vDwCCIT+2yotzqO6CUlpVowUgBKUi+8hjt7 Qt/3YhKv1Gmuh7PU36duPvoZ9pLwHWeQlv83zyF5nPH0MHF416J7uNCbT4iR2iYWHMAT Zc/d5a8QHjQZ9JX6I/jIARtAgNWYMu5is/SDKptNIfy2Fs0m60oLI17gSYi9hIUxKqDz nWZIG8Pvv+M7FMfGHcQ4MHp4fmbnOE0UyZYFowM0CIoNgDTIv8a1jR6CsZLb0Rd4klS2 lrnG3MGNTsHTABoYrKO3UnmCXSu2BPu1h6fnDKhyf5v+8VbPbjMocFVMCL1vIdUmWz8N sKDg== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=xGC3VmGxH7snSAd/IGXFwlujQYwIyoEfWMW4RKG4pWI=; b=uBsC+CMIX2l3ZXIjO3LaSUnaDuoL/XKm2FCC9xIKZgLMjeBWl5Ba4cncTN2nEJmeii tq0NGLUIbZgjOLRke+C0CEW7J/wd49M9260UyQKAbtcHaY9Rmhh/dgUWxHud//Pguyer qC/5krOdQtIgjncIMVCgXfsofFFbpl8CxX6l/G2i/GFO1TcI8fQVbAGZsHPphD3HQWS0 uS/uUJTpfhuwZkeGcTFzOrLFjo0/W5lp0+MG484haq00jX8t9N6PYei4K7vCiCbtsOYe Ole2j23UIFSgSAJxk7GvY6Am9uXSjs6PYILjW8d/DNPmVyjU6/fzzMs7zZ6PNcr61uTZ a75Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=T1LF03aR; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si22326748plz.118.2019.01.24.10.49.08; Thu, 24 Jan 2019 10:49:23 -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=@gmail.com header.s=20161025 header.b=T1LF03aR; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728960AbfAXSrQ (ORCPT + 99 others); Thu, 24 Jan 2019 13:47:16 -0500 Received: from mail-ot1-f67.google.com ([209.85.210.67]:44606 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725913AbfAXSrP (ORCPT ); Thu, 24 Jan 2019 13:47:15 -0500 Received: by mail-ot1-f67.google.com with SMTP id g16so2177053otg.11; Thu, 24 Jan 2019 10:47:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=xGC3VmGxH7snSAd/IGXFwlujQYwIyoEfWMW4RKG4pWI=; b=T1LF03aRDLYje708eIURsSKPPLXgdNEqB+jQlJqqa23aex+MQ+sgPJZAn0qkaGSCcp mZ1IeBUFSAHwRD8EuNm/iAjR8vDmaZO91kCtaOzq1u7M/z8YJVPzMxMwpRgGhIfPRgWG /462y0BEs+9W2JblswLVfE+fp0VHvVi5HfYyj4xhZObZLPxgS8Ojm9s3UrhnMVoDtly7 ENDbLsTJXCd3ryrNk3HA036qwmEMIFhP6B7c5weqVuuxDBRUPral9k3ia/vJkwAxoT5b WfZZGqwE0dkPviHG3naoSrNzvZBMnXuSHpLskh932F21Y0Z4UL0x85BTKduRA4wR1Xk5 tm7w== 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:content-transfer-encoding; bh=xGC3VmGxH7snSAd/IGXFwlujQYwIyoEfWMW4RKG4pWI=; b=oplncEVaR02uWxOw3AkkGsavEzKKtNdWuQzolrTNPw+0D3W31U+KXBkNZ1VEq0HQzo ZrSTXYJtL6Y2N93yHzrJbLeKoJ6frc0rDrrHex6+hzhswr03hqvRClPY9son1un+ncOH wSuZ0dNfQHDAb2IjMCsdbok7NqItZxrBk75ImQZ8nm1fKAiBCLzfEiCCAwDn+5Dhu57q psSZjvo2iTjtE4gpkU3sjfl0z3qrA66jOn/HtSVzixUVNZW8HKe9zPY2yVxFAf3TjaWg HRsEAL2zRfGXTci9JDTIG3W113sH5JpEbXUYZ7UbEyMHZ1W9eiUJzwGpe+UnV4nNlICZ Lbwg== X-Gm-Message-State: AJcUukdtBDH1HHM247m4v9tNR1qW3gCj53MJVKcv9qjfFEBtYN4/tlLf XqIhABQ3zx3bXJFcNtYRk53pFkFE1W6Nfzg309k= X-Received: by 2002:a05:6830:2115:: with SMTP id i21mr5450416otc.237.1548355634599; Thu, 24 Jan 2019 10:47:14 -0800 (PST) MIME-Version: 1.0 References: <20190123175142.12604-1-matwey@sai.msu.ru> In-Reply-To: <20190123175142.12604-1-matwey@sai.msu.ru> From: "Matwey V. Kornilov" Date: Thu, 24 Jan 2019 21:47:02 +0300 Message-ID: Subject: Re: [PATCH] usb: musb: Fix potential NULL dereference To: Bin Liu , Greg Kroah-Hartman Cc: "open list:MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER" , open list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org By the way, why do we need to store the qh in urb->hcpriv? qh can always be accessible through urb->ep->hcpriv Wouldn't it be better to drop entire urb->hcpriv usage? =D1=81=D1=80, 23 =D1=8F=D0=BD=D0=B2. 2019 =D0=B3. =D0=B2 20:52, Matwey V. K= ornilov : > > We assign "urb->hcpriv =3D qh;" a few lines down. The valid qh for the ur= b 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 =3D NULL; > + qh =3D hep->hcpriv; > ret =3D 0; > } else > ret =3D musb_schedule(musb, qh, > -- > 2.16.4 > --=20 With best regards, Matwey V. Kornilov