Received: by 10.213.65.68 with SMTP id h4csp572523imn; Tue, 13 Mar 2018 13:30:55 -0700 (PDT) X-Google-Smtp-Source: AG47ELuputYeoM0ZSukwhZYU5QiU/HCINa399eK7p3qwavbrwe3uk5d29LvlpdxXVWxqv/SxbxFw X-Received: by 10.99.154.81 with SMTP id e17mr1530235pgo.311.1520973055899; Tue, 13 Mar 2018 13:30:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520973055; cv=none; d=google.com; s=arc-20160816; b=Ohig1rmUsk2ZSf8bU4+9P2Un0D/reb5NQTMJe1G5KLSjrs4zh6jX+hVLvSDID5p4ih q4Lzcf9mbdD5nDYYffwEzGEs8Ds0Z7TiBiVa5xAgifWUSmLe6pOtNkemJkoNKcnpgtif ebTu7Un6A0sJ0M67yFOfVYdPpsBFQbBUYwx9BadJPwSex5MD0MMd3X/U4nHMWgDTJoZD bHKDJfgNCmbl4hIt+zEK/F2LuCKPbtF6wwAtatMH78KTxL9fzdobdCswL7vFflZ8XO/h rTOk30q24nF7KcnOd61rxf29dJZeKaoOKUskgomYQSF9iUPgO25VXNtaJOM9EL+9+vFv H7eA== 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:dkim-signature:arc-authentication-results; bh=OqSKcYvpna6gTlezRfMi8JZcDf0uUq9So/nXVITpJas=; b=aQQs6t26liMZyWGS51Oy+MDDxReO1gE6vBK7hZ65/T6dDEUu+wT9pa0eYz97sOangw krDz11Xhgqfgrblk6y+DocBfIVDA95pYOFL+jDHXocohcLisI0orrZYthNhWo/obLEKj rH9hpVEZ2/U7KSQTNmIKzWmjjj+jnl45r0/rPzNEn9LcbJ3vU12752CR6IzirMs5GKiN eIv375TYAL6oYz+BckSSZbeAs1IERSOQs0iFa4RL1j7F+vwh+80/wWxWozmBbnhz7g6R 1YhXHqwxUekgAQVisGqqnkm7mh9XseHJvUA1jt3UXRyLaNLdpMpgIXPxefTOC9fmldAe sIBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=eKUP96us; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 133si622442pgf.228.2018.03.13.13.30.41; Tue, 13 Mar 2018 13:30:55 -0700 (PDT) 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=fail header.i=@gmail.com header.s=20161025 header.b=eKUP96us; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932472AbeCMU3p (ORCPT + 99 others); Tue, 13 Mar 2018 16:29:45 -0400 Received: from mail-yw0-f193.google.com ([209.85.161.193]:41483 "EHLO mail-yw0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932257AbeCMU3l (ORCPT ); Tue, 13 Mar 2018 16:29:41 -0400 Received: by mail-yw0-f193.google.com with SMTP id w12so665708ywa.8; Tue, 13 Mar 2018 13:29:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=OqSKcYvpna6gTlezRfMi8JZcDf0uUq9So/nXVITpJas=; b=eKUP96usPo3F+YrjdUm6t978W5zihfp6pxyfwaqAancxEe8GuZpwjvvEMIv7vBKMiW CpuRPAfaK9JGrnm2ZWAobqjDe4ltR0SXrqVrDq6g7WaQw0FxTOeXgHaVlWiL16v9x24A Actycps742+mQlYjyIQ5ig2ri4UlC3NyJ5l+a9Fdd8I+sCRaOufb2sHxevUb3xN0/T6/ ZB64BHTocyyTFi5pf6qp2CGyKCM6lZo+gY5QQ2Xp8wR0LQXT9CIJSDgepK8KYae4geE5 M/+jNnRo8p8dVgKh2zMPOzFS+GTnOuJOi9l0XHPj+0bxQe5vs5Y81NYHd37SzJlPqY3T mtow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=OqSKcYvpna6gTlezRfMi8JZcDf0uUq9So/nXVITpJas=; b=h1gJAdYH6dWoSyEuTyETErUHnMTRdoitNMzTkO4XYGSitabaaA3HujBW5tM75v2tq/ jw8jeAAgNlJWBh8JM8sT/9ZcED7BBrA+j9iH4dKc4db7Ag2HYof626qlE8Djl94rE77J AQvR2V+O/tuiz1/wMFq9Ep1w4FkUClta1jcedandrMboJzaqKQMeYUElfzFcqJywgTb0 pMClVgKklwFjBLn/00HfHePhMafRJgtibG43irNsvEFmoUAdNHy9hv4Ibh3BII4vwCwH 2z2BBif7xzPK6QqJDyS8+73s6BY7+5fsaO2xh7pGgDO5qKxaZy72j3Yi/XuqvJq+Jav3 aBSw== X-Gm-Message-State: AElRT7Hjr6PyIAJfAHEh/rB6lkoCexMtYGPG2Ypr/5t3cqfw3dCvNIKd dNu2nA2psVIKKY6VZWNSHII= X-Received: by 10.129.113.133 with SMTP id m127mr1637235ywc.76.1520972981242; Tue, 13 Mar 2018 13:29:41 -0700 (PDT) Received: from localhost ([2620:10d:c091:200::3:abaa]) by smtp.gmail.com with ESMTPSA id u201sm394179ywf.10.2018.03.13.13.29.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Mar 2018 13:29:40 -0700 (PDT) Date: Tue, 13 Mar 2018 13:29:38 -0700 From: Tejun Heo To: Taras Kondratiuk Cc: Lin Ming , xe-linux-external@cisco.com, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] libata: add refcounting to ata_host Message-ID: <20180313202938.GI2943022@devbig577.frc2.facebook.com> References: <20171113201037.GL983427@devbig577.frc2.facebook.com> <1520584481-9643-1-git-send-email-takondra@cisco.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1520584481-9643-1-git-send-email-takondra@cisco.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 09, 2018 at 08:34:41AM +0000, Taras Kondratiuk wrote: > After commit 9a6d6a2ddabb ("ata: make ata port as parent device of scsi > host") manual driver unbind/remove causes use-after-free. > > Unbind unconditionally invokes devres_release_all() which calls > ata_host_release() and frees ata_host/ata_port memory while it is still > being referenced as a parent of SCSI host. When SCSI host is finally > released scsi_host_dev_release() calls put_device(parent) and accesses > freed ata_port memory. > > Add reference counting to make sure that ata_host lives long enough. > > Bug report: https://lkml.org/lkml/2017/11/1/945 > Fixes: 9a6d6a2ddabb ("ata: make ata port as parent device of scsi host") > Cc: Tejun Heo > Cc: Lin Ming > Cc: linux-ide@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Taras Kondratiuk Applied to libata/for-4.17. Thanks. -- tejun