Received: by 10.223.164.202 with SMTP id h10csp636253wrb; Mon, 13 Nov 2017 12:10:38 -0800 (PST) X-Google-Smtp-Source: AGs4zMb8Cq9L2bKfuS9gVToU3t213KqCmWxCh/9XSzn1Evz9DdbxeD1/taU8aIdmTwYnGjIfoK+d X-Received: by 10.84.174.1 with SMTP id q1mr10279845plb.220.1510603838585; Mon, 13 Nov 2017 12:10:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510603838; cv=none; d=google.com; s=arc-20160816; b=0+d1bx8uX998w32oUivTUEtytpRw+USmI4sDuMEMWnkjtBthHaTQRuWkmDvCFYmcG9 QN3gh1NKWWnWolibusM0+GA+iza7JEpC3wpkqLzPnYwjRW/moj+dj2QR7jwWYgku+01f o4dGdx7wISHBqConAQuq125mv8GQz6POZKtCAf+Jtd1NSggDnM+XRyE3P5e09twLGn4v v6inu1mMQtW8LV6GQCXdDDH/nqRCBck9oiGrUwKO47f9H5Kk5/1+Rg4qV/cTzgHcx+NN RFRJs5QlvqZNAOLy75KzuOrMH6N8zCtKoRmtTw3dbCuBpTc3uUgAC87YGEpxj2YFPywv 22GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:user-agent:message-id :references:cc:in-reply-to:from:to:content-transfer-encoding :mime-version:dkim-signature:arc-authentication-results; bh=AcWghV61W6no0IvX34pDWjhK1BDKDZ2ezDUd5P71aa4=; b=Ooo8cavj7E3mGJblrdWWk2gWUOIAYO+JozlwQpEyjXr7/ck6KqCGa3PtN8inT4P90p PXJ0/5febOc6APJw/F/ubOKiWjdOFsmKpyhNLJmgfVbaDOewjWwxcMG7vnJLSh0Ut/ck ZcAlOy1FTcrdDq+4m1vaKnVis11bbTWhJXjfm/yDNvnse9fbkLQb3JL06Hr0CRykVRXK 2r5SFIxT1lP4aWFzoDTPLarnwqhnnbv8hvxoygfqd/4hDkcIrCSbFUywbBPQLjao6MsP W74fvnxvk8yDP/zg2QlN9OVActVkmCiwIu0G0rOzRZLQQsWGdtQVYRhEeaeENYiILmZm THuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=bwMLiskF; 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=NONE dis=NONE) header.from=cisco.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e32si2522152plb.674.2017.11.13.12.10.26; Mon, 13 Nov 2017 12:10:38 -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=@cisco.com header.s=iport header.b=bwMLiskF; 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=NONE dis=NONE) header.from=cisco.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755287AbdKMUJe (ORCPT + 87 others); Mon, 13 Nov 2017 15:09:34 -0500 Received: from rcdn-iport-1.cisco.com ([173.37.86.72]:18308 "EHLO rcdn-iport-1.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752466AbdKMUJ3 (ORCPT ); Mon, 13 Nov 2017 15:09:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1054; q=dns/txt; s=iport; t=1510603768; x=1511813368; h=mime-version:content-transfer-encoding:to:from: in-reply-to:cc:references:message-id:subject:date; bh=RvacaBbAibACbAod6wbOVFt4BMwjjyZvOGyAmUPjJYI=; b=bwMLiskFnjKPG7GtJwKapTaUfDvEQMPTm8S4E3D9IEH9kC0rhtZhQWGR MFImxOQJQEz9KI1mpF/tPUnu8tvASjMT9/Z+Z5bu5A+ib80GpsNS77yvT tpqw5iTH08zzn9bU7HAG6xNiyEtH0Blz+zLIp5aYrZemI/8yo1XZp+SYc A=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CgAQCe+gla/5ldJa1bGQEBAQEBAQEBA?= =?us-ascii?q?QEBAQcBAQEBAYM1gVKEJYsTjjqBVyaYYQqFOwKEZUIVAQEBAQEBAQEBayiFHwE?= =?us-ascii?q?FI1YQCw4KAgImAgJHEAaKKA2re4IniwkBAQEBAQEBAQEBAQEBAQEBAQEgFHuCJ?= =?us-ascii?q?YIHgVWCHYJ2hReDFYJjBZJ7jy+oRpYkgTk1IoFyehWBCgtFgVSEfyCJFAEBAQ?= X-IronPort-AV: E=Sophos;i="5.44,389,1505779200"; d="scan'208";a="323752293" Received: from rcdn-core-2.cisco.com ([173.37.93.153]) by rcdn-iport-1.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Nov 2017 20:09:27 +0000 Received: from localhost (sjc-vpn3-1189.cisco.com [10.21.68.165]) by rcdn-core-2.cisco.com (8.14.5/8.14.5) with ESMTP id vADK9RZs006702; Mon, 13 Nov 2017 20:09:27 GMT Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: Tejun Heo From: Taras Kondratiuk In-Reply-To: <20171106152452.GA3252168@devbig577.frc2.facebook.com> Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, xe-linux-external@cisco.com, Lin Ming References: <150957868766.7160.13267337838101258462@takondra-t460s> <20171103131937.GQ3252168@devbig577.frc2.facebook.com> <150972673653.5502.7168940193960185267@takondra-t460s> <20171106152452.GA3252168@devbig577.frc2.facebook.com> Message-ID: <151060376750.7561.9196983678072496472@takondra-t460s> User-Agent: alot/0.6 Subject: Re: Manual unbind of ATA devices causes use-after-free Date: Mon, 13 Nov 2017 12:09:27 -0800 X-Auto-Response-Suppress: DR, OOF, AutoReply Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lin, Quoting Tejun Heo (2017-11-06 07:24:52) > Hello, > = > On Fri, Nov 03, 2017 at 09:32:16AM -0700, Taras Kondratiuk wrote: > > Also even if sg_release() is called before ata_host_release() there is > > still no guarantee that the last reference will be dropped, because > > sg_release() schedules sg_remove_sfp_usercontext() to do actual release > > and the work may not be completed in time. > = > Hmmm, we didn't use to put in ata device structs in the kobject tree, > so this wasn't an issue. This was changed by 9a6d6a2ddabb ("ata: make > ata port as parent device of scsi host") while adding the transport > support. While doing that, we didn't change the release path to match > it, so the failure. > = > cc'ing Lin. Lin, can you take a look at this? I'm ready to test whenever you have something. If you don't have time to look at this then can you recommend a proper way to fix it. Is it better to change device hierarchy back to previous state (revert 9a6d6a2ddabb) or add reference counting to ata_host? From 1583330911094473181@xxx Mon Nov 06 15:27:04 +0000 2017 X-GM-THRID: 1582908631068481434 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread