Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1127833rwb; Thu, 11 Aug 2022 16:46:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR78BtTd1Y0+dS3hujiqPIPbu9+Ef7nCEDdoexOb2fbQQeEwacl/EPhLWyE2OleCz1w5rR/y X-Received: by 2002:a63:4964:0:b0:41c:c1c3:8836 with SMTP id y36-20020a634964000000b0041cc1c38836mr1039769pgk.346.1660261617999; Thu, 11 Aug 2022 16:46:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660261617; cv=none; d=google.com; s=arc-20160816; b=Y3Tj1WCW/CPXxiyTCTA7EJGu72moG30lWeELnpyJ3qQXNWy0eD2KOxAAh8EYbrkcgj eN8g3L50oxy8I0tDPUecqXE91QontjCT3sNblV+yg9Q/KElQZ2B7zkMG9gLPewwROCms uQHL2AUgIaerCSWLjaHErZlxVI/MEQ14siAXV+QcQZuyFVFdnq0AaDMUsUcA62ViK3g4 9hck+JTiymE8jIJawXjxhJhA3eCJmrcqFJ1QXruoQE+KTQJJxMpQLlqQExTwyYa0yVy2 Kw26Li13+bMARhXYsUUL/hJhg1NxViKZYy0SEe1M7FvEo9n694MkZY62BNpQAWi6AnSy CAag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=XV3d3jsQUJYVJchztvaIBQqSUAMrrh69qI/8EtCuYe4=; b=W3uX3OrxyzVDz7obrrJh9rN558Y4qHr9DSFBzepw9E7+eddfwb6BvfKoj3EcgtPV2W mS9hp5kKMSFkwStlLw7eY66S0diepnslAgrrVKHWtaHWBEEIp4+ElG2fG0kHs3uffujm 7tBoNi8DruJ/FFfk0kWZcn+e/PZs4OnzGkv7gk1keII0rxRDzV5ZgW4qTx48tmOWq34I zzDnaeLCQtOzl2Ob5rZy4ScyKk3+HvIV9mauEuR30qqxnmoJwCmQy1tUHKWDRfwoWHUG Fr8V5apPIW7KO7GhlnrDkwn08eDglAQY2i4K/DbshGTDgu0MMkBXfp6FeAGSu6clhRPS Odxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=tAYpw4CD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u12-20020a170903124c00b0016d018cc597si638330plh.416.2022.08.11.16.46.43; Thu, 11 Aug 2022 16:46:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=tAYpw4CD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236564AbiHKXEH (ORCPT + 99 others); Thu, 11 Aug 2022 19:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235999AbiHKXEF (ORCPT ); Thu, 11 Aug 2022 19:04:05 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B8FC6E2DD for ; Thu, 11 Aug 2022 16:04:04 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id z19so18184089plb.1 for ; Thu, 11 Aug 2022 16:04:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=XV3d3jsQUJYVJchztvaIBQqSUAMrrh69qI/8EtCuYe4=; b=tAYpw4CDkWc6eiIf/KCP+KBGnVlg8ib0fvqDt5ayrPmOQ3UDOO3arWXihLT3hSbZKj 1pdlYcKzB+T4+SasFbEJMHOq/hP4vIojAIE07EA0aHkak71KSWZBqg5GapGWPMtJLR+T GWQhqJ6aYuIolDRFFAQSA5ibYCoyfDyxmshgkCAZsT/x/Gq39TTr0V8mlZWHQNlKK+bo VtX3WQYPMJWzrLJmDLGqRrEz1l878YJIcYf9Aei5WQqWVRInY6G8UDjqe/rXnqPky2As vI59jAUyB/EIs2MwGoH2eStvS3NW2P0nzF4GRBOzPfpXoAezr8zzT3N5KjemNsHcQkk4 GAXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=XV3d3jsQUJYVJchztvaIBQqSUAMrrh69qI/8EtCuYe4=; b=EMDik8gpejwdf7CH1rDxV08ZJYUuhnUWVce0HSfRWJsfSg9gs1j0Qkh1u6EBdtczcQ t4rD3NE+dXz8G6bX/7vYDaAuhnhKGqOP8yk41fgxH59iEUdFS2BSqKiha4zbhj3rGcfY mLHd1HdmGPTvES2Iaf4xGyzn7Yab5z1TnsNhSZ6a3TJ9LBiE1CRqMQv312MAY3fzCDBm /swFMYGOOGtQpbmkexjoQvs3C5JoeitXxclIdgzmc0UalztW5YLx1ewq1D/jNv2q2ZPL 7N6+F4IOrMKxmh9GkqP6rMAPOpX56sHe5uUk74gHIfCO4P/4eJvlxYHwCmeeYtPoKkuQ hsgw== X-Gm-Message-State: ACgBeo3BLJBVR7tEuDUT7RQSdeSpKbpIqb5cT+3x5gbA1y+M7xxqW+NP Izz71iitZzEFB8g0EAF+JaE1ag== X-Received: by 2002:a17:90a:b00b:b0:1f1:6023:dacd with SMTP id x11-20020a17090ab00b00b001f16023dacdmr10643291pjq.184.1660259043795; Thu, 11 Aug 2022 16:04:03 -0700 (PDT) Received: from [192.168.1.100] ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id w186-20020a627bc3000000b005289ef6db79sm232168pfc.32.2022.08.11.16.04.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 Aug 2022 16:04:03 -0700 (PDT) Message-ID: <05cfb9dc-c740-5764-35f9-b5636e0577cb@kernel.dk> Date: Thu, 11 Aug 2022 17:04:01 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v2] virtio-blk: Avoid use-after-free on suspend/resume Content-Language: en-US To: Shigeru Yoshida , mst@redhat.com, jasowang@redhat.com Cc: pbonzini@redhat.com, stefanha@redhat.com, virtualization@lists.linux-foundation.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, suwan.kim027@gmail.com References: <20220810160948.959781-1-syoshida@redhat.com> From: Jens Axboe In-Reply-To: <20220810160948.959781-1-syoshida@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/10/22 10:09 AM, Shigeru Yoshida wrote: > +static inline struct virtio_blk_vq *get_virtio_blk_vq(struct blk_mq_hw_ctx *hctx) > +{ > + struct virtio_blk *vblk = hctx->queue->queuedata; > + struct virtio_blk_vq *vq = &vblk->vqs[hctx->queue_num]; > + > + return vq; > +} Would probably be cleaner as: static struct virtio_blk_vq *get_virtio_blk_vq(struct blk_mq_hw_ctx *hctx) { struct virtio_blk *vblk = hctx->queue->queuedata; return &vblk->vqs[hctx->queue_num]; } dropping the 'vq' variable, and also dropping the inline as the compiler will work that out anyway. Apart from that minor nit, looks good to me. -- Jens Axboe