From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61E11C48BDF for ; Thu, 24 Jun 2021 04:53:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4354E613D5 for ; Thu, 24 Jun 2021 04:53:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230160AbhFXEyx convert rfc822-to-8bit (ORCPT ); Thu, 24 Jun 2021 00:54:53 -0400 Received: from yyz.mikelr.com ([170.75.163.43]:34238 "EHLO yyz.mikelr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229932AbhFXEys (ORCPT ); Thu, 24 Jun 2021 00:54:48 -0400 Received: from glidewell.localnet (198-84-194-208.cpe.teksavvy.com [198.84.194.208]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by yyz.mikelr.com (Postfix) with ESMTPSA id 2E7E54FA68; Thu, 24 Jun 2021 00:52:02 -0400 (EDT) From: Mikel Rychliski To: Christian =?ISO-8859-1?Q?K=F6nig?= Cc: Alex Deucher , "Pan, Xinhui" , David Airlie , Daniel Vetter , Thomas =?ISO-8859-1?Q?Hellstr=F6m?= , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] drm/radeon: Fix NULL dereference when updating memory stats Date: Thu, 24 Jun 2021 00:52:01 -0400 Message-ID: <12410445.c4f2iDpdjA@glidewell> In-Reply-To: <085b7f51-15b8-42e0-fcf0-66da839542c8@amd.com> References: <20210622212613.16302-1-mikel@mikelr.com> <085b7f51-15b8-42e0-fcf0-66da839542c8@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="iso-8859-1" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday, June 23, 2021 2:55:04 AM EDT Christian König wrote: > Please rather keep the new resource as parameter here and update before > adjusting bo->resource. > > This way you also don't need to export radeon_update_memory_usage(). I wasn't sure exactly what you intended with the request to "update before adjusting bo->resource". Assuming the statistics update is done as part of radeon_bo_move_notify(), I believe that function cannot be called any earlier in radeon_bo_move(). If it were, the source object would be invalidated before it moved. So I assume you're suggesting updating the memory usage earlier in bo_move_notify (before the early return for ghost objects). Thanks, Mikel