Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2776954ybk; Mon, 18 May 2020 07:41:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFbGP9Wz++LLhEIclfnp7nEFAIPArs9wObq+BZ5TXQN4tl/TT7VKIHYH0Hhq0ppex1+ZAo X-Received: by 2002:a50:e04c:: with SMTP id g12mr14126847edl.74.1589812917807; Mon, 18 May 2020 07:41:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589812917; cv=none; d=google.com; s=arc-20160816; b=fh/Eao1onyDIq8aQWU6pCNA/j17WR8RZNUPUXPt3FWPzmrsBHGPqgyJ8KO95FoSDpq hdp9PymRmDjaTVum0ZECAvYlH4R1Ku54OyCB0/xQfuAQGqdQyVDzdolJ7FdHEVtgTMLr pr5Nwud86CMY6QXz+ZoNl5dFsTN+L3KpbzOmaGqKVI9K0L4VoBWRm4J2H4r6g8dr+72w HtDYIeU158UyrAnjWVKGMjF00F0sLS8bRSENxtvhdvQ/bzVtno0iBqfXikSq5w1GbNrK z/6LUjeBIpjK1azHG1Xw5nmstD2RrtK+3WJyhcTgecccparp9tGuQgtDS735cWzBPoBF k36w== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject; bh=v/Lrwkj7ubPYecCIOxmLzR7ynh9p8lUjesL2Dh/wkrM=; b=UA7bKn3j/afmnDTWffVmYqwX487B4KlHQq+UwZIbv0PVaRIA0sw6Jn9DP2nb+YPaCa c5mKPMPuALZSPuy7nJVf3j+W+eT5byhfcYZ6uixMFdZfg14OaQx4hcjcvZm+dAcdiKZC anCNXmGo6g6prDQ22wdXlvbsfXaD0Q9ITJ1JSiPl68VC5UXmpFK352WHoEnaK85DPPJc m9OGRIrxUXm5u86k5M/VM2VZvkzulKSyqnUtYgKFEFy7Vcv+aPwvY+gZzbegWTwIDwFT Nz3vcxI0VLaAS0IVlRNykUVPRjEdDDdkaxRwgDU2R97J4LdzArJm/oLIkJygeMIHH3RX /qHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s24si6728553ejx.153.2020.05.18.07.41.33; Mon, 18 May 2020 07:41:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728045AbgEROje (ORCPT + 99 others); Mon, 18 May 2020 10:39:34 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:39217 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726918AbgEROjd (ORCPT ); Mon, 18 May 2020 10:39:33 -0400 Received: by mail-pf1-f194.google.com with SMTP id b190so5044322pfg.6; Mon, 18 May 2020 07:39:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=v/Lrwkj7ubPYecCIOxmLzR7ynh9p8lUjesL2Dh/wkrM=; b=GH2AGYyJyuVwur+ava7+7Xq/o/bCLkYGr+aSOcanDeM2tZLls9m/EJgvl2L5x9+XMC e9+mtiMayO4x8+vZSxbgRaW/xJDVb0o3OwiYy+mRWJ1Lg3E1+2jkRWOhcjzp4UrKHEio sf/2pfdO4wi4ygU1wPlNYNwXr51+jF2AirJWHKFM3WK5KY7f9GOm7n527xcD7DMzVmjF GeE/xw7O8uC9v8KmqW/WWuilItn9qhixj9YFU/twBWaKokR0Rckbw+QNunfDAfwJtItX sgbuwvb/cdHqQj0Ma5cLJRcbWWsTW/BaIbzLyTDjWrwOOcwad8hzd0YhFoBR6nP8ntSP p9Rg== X-Gm-Message-State: AOAM532qFBktGoso1J1vbPK97QJR8emKRpQ1GpnetT1+hZWZPgeWBMPx rAqRizLo34bOHgn2F5tQxKlS3Au/ X-Received: by 2002:a63:f925:: with SMTP id h37mr15995306pgi.112.1589812772347; Mon, 18 May 2020 07:39:32 -0700 (PDT) Received: from ?IPv6:2601:647:4000:d7:dc5d:b628:d57b:164? ([2601:647:4000:d7:dc5d:b628:d57b:164]) by smtp.gmail.com with ESMTPSA id h7sm3194729pgn.60.2020.05.18.07.39.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 May 2020 07:39:31 -0700 (PDT) Subject: Re: [PATCH] scsi: Fix incorrect usage of shost_for_each_device To: Ye Bin , martin.petersen@oracle.com, jejb@linux.ibm.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200518074420.39275-1-yebin10@huawei.com> From: Bart Van Assche Autocrypt: addr=bvanassche@acm.org; prefer-encrypt=mutual; keydata= mQENBFSOu4oBCADcRWxVUvkkvRmmwTwIjIJvZOu6wNm+dz5AF4z0FHW2KNZL3oheO3P8UZWr LQOrCfRcK8e/sIs2Y2D3Lg/SL7qqbMehGEYcJptu6mKkywBfoYbtBkVoJ/jQsi2H0vBiiCOy fmxMHIPcYxaJdXxrOG2UO4B60Y/BzE6OrPDT44w4cZA9DH5xialliWU447Bts8TJNa3lZKS1 AvW1ZklbvJfAJJAwzDih35LxU2fcWbmhPa7EO2DCv/LM1B10GBB/oQB5kvlq4aA2PSIWkqz4 3SI5kCPSsygD6wKnbRsvNn2mIACva6VHdm62A7xel5dJRfpQjXj2snd1F/YNoNc66U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bL1DY7zf2hYXLLzsJR mSsED/1nlJ9Oq5fALdNEPgDyPUerqHxcmIub+pF0AzJoYHK5punqpqfGmqPbjxrJLPJfHVKy goMj5DlBMoYqEgpbwdUYkH6QdizJJCur4icy8GUNbisFYABeoJ91pnD4IGei3MTdvINSZI5e Message-ID: <95d13fe2-e267-a536-def4-083a20c016be@acm.org> Date: Mon, 18 May 2020 07:39:30 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200518074420.39275-1-yebin10@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-05-18 00:44, Ye Bin wrote: > shost_for_each_device(sdev, shost) \ > for ((sdev) = __scsi_iterate_devices((shost), NULL); \ > (sdev); \ > (sdev) = __scsi_iterate_devices((shost), (sdev))) > > When terminating shost_for_each_device() iteration with break or return, > scsi_device_put() should be used to prevent stale scsi device references from > being left behind. Reviewed-by: Bart Van Assche