From patchwork Tue Dec 6 07:55:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaoqian Lin X-Patchwork-Id: 30121 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2686004wrr; Mon, 5 Dec 2022 23:57:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf5wYu6c7ixhca8lSBEgiKE6C5bFee8JqCwFTS1uwZUd6IMr2R0WtToTd+i1m1IIFOMMuf41 X-Received: by 2002:a17:903:444:b0:189:c8ff:f262 with SMTP id iw4-20020a170903044400b00189c8fff262mr14082450plb.157.1670313455237; Mon, 05 Dec 2022 23:57:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670313455; cv=none; d=google.com; s=arc-20160816; b=R2+ONG3t8lm8X+suzXtR0t7NVHAbpTnkgRZxT7dI9mau+Qn1oC7FpGmmutNetnX3Sk aRmPsVCZag0yRwCi3VCsdI/0z6bP02oGmaqxzG2XqOl5+omH55YT8ukrWYdulQoTfqTO 4Z6AHyfCyamTUYLxHS9ZejpX9H/1gxYsF7uiBXGu+YxFk/0YTXDy4GYLbdMLGchR75MN 9M4f7cAamTQ38aUSnF2PENkhVpUY/7gbPKKeErYSeKHeXHMJ54y6ugzLtIuintWEq8B9 mMG4CWScit2nY7t6P03O5/BiDF0kc8MrG6HqsjCyzy3vqF8QDkbEUxP4CzDeuuYIwKZz GEpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+m1uoCSNZiNORNnWeYA/gOGOdLV8fKAWwqiFnQ4JGO4=; b=JjjJJxLB3D+Cb7DGrAEzaqP+sQT0R3WkxTLuWcGD8b6tasif3uEjjlYtthvSIG+6JN EM2m3f2xwF4lyvd1uSuK4RCRJamx/RJ/UaVbL+fsbvFfrhOGVsMmcZB7uYrqm0UO9L4z NJVUDrvR8PkowWQJRx7bc+zfvYH51eSNvb9guo2dmLS1rmTiKqLIqHQQgkF6X4V8JEvD DClijs3h4EgrsqW1eyP/vWysvPz80sB/qr+8oXcq7Q4miwXkBZcg7P7pXHrDFyEiwmiW m5AIIa2rifs0U5AmPtf9FuJoawy58TfgQCz87rIfUKx/hsttWs3vkaiPBQp73642oB7h Ljjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FLYjs2Bs; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lw9-20020a17090b180900b00218a8a158f5si22150474pjb.161.2022.12.05.23.57.22; Mon, 05 Dec 2022 23:57:35 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=FLYjs2Bs; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231290AbiLFHz1 (ORCPT + 99 others); Tue, 6 Dec 2022 02:55:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbiLFHz0 (ORCPT ); Tue, 6 Dec 2022 02:55:26 -0500 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A04014019; Mon, 5 Dec 2022 23:55:25 -0800 (PST) Received: by mail-pg1-x532.google.com with SMTP id f9so12677017pgf.7; Mon, 05 Dec 2022 23:55:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+m1uoCSNZiNORNnWeYA/gOGOdLV8fKAWwqiFnQ4JGO4=; b=FLYjs2BsV+r65aZM3AJb2KO8o01qTTcxiXypSxBwse82Ge2U8dGdI5gwwrNj8KB6zO Vg3bwEuvpm2rok9Zr22M5HWzhrr//eVcFAt6p7YGtICttZPnajxCmYf/Ui63XHiiaS75 vqseQZ/25z4WZlVG4yEYuAgmpOabbz6ZizTTBaA3AByXlp/YxcXF2IRa5pg24/shxCYD ZbY5gosvJBuIlzlsU9I0xKFzQfAF9Q0K/l+PdtPFNCHxXmyY4uudoiszGeRfhQsca0tW vXHomb3+0Un+BkjnH9GQjqxW9i5Wdcq9bTwyS0QT8EseISs88Dy+273WAs1hePzG72rH zjxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=+m1uoCSNZiNORNnWeYA/gOGOdLV8fKAWwqiFnQ4JGO4=; b=BbPgftm6JXJlap8NNajxtA9Ydw0dWBseMhPhlmWCG2/GgoysJPygTI/mT+GmFcg7sq qBQhvmsscLvsG46ihlWueE7V/yQlOrmMXqv3+KIZtP/p7QuOBTvdgCKCvzYRgQPicGAD 9Q/HKiAWOb0bQOMgng/6NcdhkdINAv5Nwqu2k0iUG5cydanCGPgJu8ClUfFq9zWYQHa2 qn2kvVx9vBOxERRWNE/HcxdLyNzK1Q5XE7XjQ3fk+broY75ZUsu7IRYhWCXUldcpt61w 1jH+YQB2OFaNrHpBorsUMdnBO5MJc4dWtfS7R+dVyjmBTJagrhErD8bTDhXg0oRenqJ9 wIow== X-Gm-Message-State: ANoB5pmGCUT63/XPOn4aoM1AWVsu7ugnh/ISUZTw/iLS7sXAL6xEJNe0 ZeYxT6TnpfOiGkDrAKWN4r4= X-Received: by 2002:a05:6a00:27ab:b0:56c:71a4:efe with SMTP id bd43-20020a056a0027ab00b0056c71a40efemr72801167pfb.84.1670313324560; Mon, 05 Dec 2022 23:55:24 -0800 (PST) Received: from localhost.localdomain ([202.120.234.246]) by smtp.googlemail.com with ESMTPSA id i14-20020a17090332ce00b00189422a6b8bsm11951284plr.91.2022.12.05.23.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 23:55:23 -0800 (PST) From: Miaoqian Lin To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Stephen Boyd , Douglas Anderson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: linmq006@gmail.com Subject: [PATCH] drm/msm/dpu: Fix memory leak in msm_mdss_parse_data_bus_icc_path Date: Tue, 6 Dec 2022 11:55:12 +0400 Message-Id: <20221206075512.812389-1-linmq006@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751450601677803323?= X-GMAIL-MSGID: =?utf-8?q?1751450601677803323?= of_icc_get() alloc resources for path1, we should release it when not need anymore. Early return when IS_ERR_OR_NULL(path0) may leak path1. Add icc_put(path1) in the error path to fix this. Fixes: b9364eed9232 ("drm/msm/dpu: Move min BW request and full BW disable back to mdss") Signed-off-by: Miaoqian Lin --- drivers/gpu/drm/msm/msm_mdss.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c index e13c5c12b775..a38fa9a9a3d6 100644 --- a/drivers/gpu/drm/msm/msm_mdss.c +++ b/drivers/gpu/drm/msm/msm_mdss.c @@ -49,8 +49,10 @@ static int msm_mdss_parse_data_bus_icc_path(struct device *dev, struct icc_path *path0 = of_icc_get(dev, "mdp0-mem"); struct icc_path *path1 = of_icc_get(dev, "mdp1-mem"); - if (IS_ERR_OR_NULL(path0)) + if (IS_ERR_OR_NULL(path0)) { + icc_put(path1); return PTR_ERR_OR_ZERO(path0); + } msm_mdss->path[0] = path0; msm_mdss->num_paths = 1;