Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4401175ybc; Tue, 26 Nov 2019 08:22:41 -0800 (PST) X-Google-Smtp-Source: APXvYqwCk/0DFdpa52MGKcNJs/FkNhlNnqP8TDUr69zoO5CEFo3D9Keu2OXxHg6yLGYNVODFLx4e X-Received: by 2002:a5d:46c7:: with SMTP id g7mr3102030wrs.11.1574785361854; Tue, 26 Nov 2019 08:22:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574785361; cv=none; d=google.com; s=arc-20160816; b=Bln1Rka6uHi3q9leDQ+Eq4iJuWtz0iNBsK444YXM5/klP6y8t3dAPjjJ2dZiZPvdEV ihQkzhUuu8oCVeGhhjELb4miHrqYCBb3tNqjrLp9Ed09uIT/yyx99OhKKJLTO5Ge5G5r 932eNAlHYhxCHrNepw6AZcxtoIREM64jR1fhk97CJz2vsWohqrdnASNLkXCqjvRTws5q lse+stJdzqwNBI4EEArma6IRpFtWZaocs3oQWxqX+nKgHW1EuDy3GW+WvJME/xvrFNZv rvSvWyOjBJSs9P2SEFgABOWVMmjHpxVmmj1jnXqHBz+EI5O+Oqy4kAWYWGT1DFF9obga e5xA== 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:message-id:subject:cc :to:from:date; bh=6DtObeBxxtOpIsejsGA+PFvHz1xokZCKtQ19cMoT+G8=; b=TXtSAubtJmLMswzD357Up225z0uNZmVF5Y5aFCtLDUSrFrfmuc5tuhLxM+hg5w/7YL Nz3r9rfi9bT3TEWrfaXnJV7blrVsOGgJdjaQcL6QnnQoWXU3ZnTcyYtQ3RODWYstc8Kl YhTFXVxtE3ItlwDeWvr0GV/tgnNj1zig670A8SnZuWQmG+zLfd55/JSmgZruE1dRfNoL 74X4rHZlrDS8rhJvo9Da2828xZuPQfAlzWk3kPs3WPVdogkEcRj4p+Wz1WruajwquWn7 wkWhee6ESvzeCtjoNh4V/HNrem4Y19zlP6vh9vs59Pf/+71lwyOP6+lzH9ZcGgHIePU7 TikQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c8si8905611edf.79.2019.11.26.08.22.16; Tue, 26 Nov 2019 08:22:41 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727701AbfKZPvE (ORCPT + 99 others); Tue, 26 Nov 2019 10:51:04 -0500 Received: from mga07.intel.com ([134.134.136.100]:12387 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727309AbfKZPvE (ORCPT ); Tue, 26 Nov 2019 10:51:04 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2019 07:51:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,246,1571727600"; d="scan'208";a="217184355" Received: from kuha.fi.intel.com ([10.237.72.53]) by fmsmga001.fm.intel.com with SMTP; 26 Nov 2019 07:51:00 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Tue, 26 Nov 2019 17:50:59 +0200 Date: Tue, 26 Nov 2019 17:50:59 +0200 From: Heikki Krogerus To: Wen Yang Cc: Greg Kroah-Hartman , Hans de Goede , Chunfeng Yun , Suzuki K Poulose , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: roles: fix a potential use after free Message-ID: <20191126155059.GC6428@kuha.fi.intel.com> References: <20191124142236.25671-1-wenyang@linux.alibaba.com> <20191126154913.GB6428@kuha.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191126154913.GB6428@kuha.fi.intel.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 26, 2019 at 05:49:17PM +0200, Heikki Krogerus wrote: > On Sun, Nov 24, 2019 at 10:22:36PM +0800, Wen Yang wrote: > > Free the sw structure only after we are done using it. > > This patch just moves the put_device() down a bit to avoid the > > use after free. > > > > Fixes: 5c54fcac9a9d ("usb: roles: Take care of driver module reference counting") > > Signed-off-by: Wen Yang > > Cc: Heikki Krogerus > > Cc: Hans de Goede > > Cc: Greg Kroah-Hartman > > Cc: Chunfeng Yun > > Cc: Suzuki K Poulose > > Cc: linux-usb@vger.kernel.org > > Cc: linux-kernel@vger.kernel.org Ups, sorry. I meant: Reviewed-by: Heikki Krogerus thanks, -- heikki