From patchwork Thu Aug 3 20:45:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 13340831 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 25163C001DF for ; Thu, 3 Aug 2023 20:45:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4F9C110E21C; Thu, 3 Aug 2023 20:45:29 +0000 (UTC) Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by gabe.freedesktop.org (Postfix) with ESMTPS id 94E9E10E218 for ; Thu, 3 Aug 2023 20:45:26 +0000 (UTC) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5221bd8f62eso411593a12.1 for ; Thu, 03 Aug 2023 13:45:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; t=1691095525; x=1691700325; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=gwq7e2BGej0SZexbE3Z4ILHnIul8QCUxW07mh0nlF7c=; b=eahdQWYLm4aBp348PvPDhiBvfvHh+cEjA3PsdWPPYccX1zF+H5xeO5+DrX4+0lznRb AOTHItySH2aXJjF4DMFV4h8WY48Dt6CCAdVnBPlcG8L6zAf3VB+iD1KSAgUzAF65LDnp kDQFF4Ob0CqcyRNDKDOZdU/r+AcC1cDX5TSqw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691095525; x=1691700325; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gwq7e2BGej0SZexbE3Z4ILHnIul8QCUxW07mh0nlF7c=; b=eXSJ7BBcS5c147yiP8TFtSSuvBnK+uhSXNwRU1XggfdU8htz48dr51x1Bf/aqkhMLc mtBEiJ37xk7KqdzyonhuoEFoJ8VOi/rX8/SOkrF5PnrB+LlidtrBUqxUwEokBPDkTCei DVrxTr3T4eY+faJYEVHYWcKKj6iaoVJ6qNF00g8L/jfPdPXwHypSZMdiLQBUcQI/1Fel kk1bKGrB6exgXgJUm2VBTiD4WYB1Qh9QJWTgjSYjjPdjlkKmdy6ISqVibz9Zxp9JbkXh oKv/McAw0z8UUz4pbVmGuS5sdf7lOdxkUZl0frekTKxR1Ieb4FHpIWN7gALBdpS74y1u dnjw== X-Gm-Message-State: ABy/qLaK9aNF7TIQRuDTripUR4PevXHc+AceHui9KPWEUUAHh7Y2O65r D5QBxLP+jztPuzOB3GV2IwWkHb6Y1sY+fwX0B/o= X-Google-Smtp-Source: APBJJlGuOXp4NnZ5oEOgxM5tRZf66bsssj1/M2U1Kl1rjRYL01gqSm34lliDKYtsCMB+1N7/knSg+w== X-Received: by 2002:a05:6402:430b:b0:521:66b4:13b4 with SMTP id m11-20020a056402430b00b0052166b413b4mr16395930edc.0.1691095524840; Thu, 03 Aug 2023 13:45:24 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id m13-20020aa7c2cd000000b0051df54c6a27sm262950edp.56.2023.08.03.13.45.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 13:45:24 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH] drm/msm/mdp5: Don't leak some plane state Date: Thu, 3 Aug 2023 22:45:21 +0200 Message-Id: <20230803204521.928582-1-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Abhinav Kumar , linux-arm-msm@vger.kernel.org, Dmitry Baryshkov , Daniel Vetter , freedreno@lists.freedesktop.org, dorum@noisolation.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Apparently no one noticed that mdp5 plane states leak like a sieve ever since we introduced plane_state->commit refcount a few years ago in 21a01abbe32a ("drm/atomic: Fix freeing connector/plane state too early by tracking commits, v3.") Fix it by using the right helpers. Fixes: 21a01abbe32a ("drm/atomic: Fix freeing connector/plane state too early by tracking commits, v3.") Cc: Maarten Lankhorst Cc: Daniel Vetter Cc: Rob Clark Cc: Abhinav Kumar Cc: Dmitry Baryshkov Cc: linux-arm-msm@vger.kernel.org Cc: freedreno@lists.freedesktop.org Reported-and-tested-by: dorum@noisolation.com Cc: dorum@noisolation.com Signed-off-by: Daniel Vetter Reviewed-by: Rob Clark Reviewed-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c index bd2c4ac45601..0d5ff03cb091 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c @@ -130,8 +130,7 @@ static void mdp5_plane_destroy_state(struct drm_plane *plane, { struct mdp5_plane_state *pstate = to_mdp5_plane_state(state); - if (state->fb) - drm_framebuffer_put(state->fb); + __drm_atomic_helper_plane_destroy_state(state); kfree(pstate); }