Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1154727ybt; Sun, 14 Jun 2020 12:19:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIxBK3xsU+zHiPxioChP3GVw+/85w62Jg6if/kSyT0t72P07VHsM1MHzZHgDtGMPVm5IXQ X-Received: by 2002:a17:906:8488:: with SMTP id m8mr23484176ejx.236.1592162367222; Sun, 14 Jun 2020 12:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592162367; cv=none; d=google.com; s=arc-20160816; b=zqlaWLAbeqtsnFIejsVFjSuKa5LeRD0e/g6aKeb0LnN6y+GrPmvPmh9WLJpRWH422y MRyAEg3sTlEfg6+l3ARPb3giJE0zM57PE3sBKPLB0Loh1hEroSYtibAm0CuGqacW/Ei9 e+dSbRNsbileEGE/cvNGP9H/oa/BwSohBHwNWJKOCb5tRU7mnEiQc61dtRHEKozLlUJT llq/z9kQvIaBeyGY4pMYGTl6HsqV5uab0Asfn9h/AjzBcOVSlnvkU/Q0yvKeA3YvTzv4 skeWv9n3DMhFTprlRsN5J2t4SDSKCIRGDeN6vM6nY40dm1f0ak4zdvNFcyRYH2Nb+4en 6fPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=wpwnKZ9Z6FevvyoUxw0sdksaS/2sRQ75c+duIaoaZRc=; b=izqNrBolbjfdLDs4dvV3cLevnegFzz3jF+cpkKA0FRD/mYXlH4uCp4bh+TVCj+CTll bF1F9d2yGmh7WOeELR6uurGmzt3culTAIoh4Cc0IW6cbGnTWwj6LXc643SCEqCZKFd7c vy4e2xNHqi30KVuOxxhHanNj3xQcyeRYAtbCW9fYOr+Ksgo8p0cgsAPOeLvX36TaSk41 NJpRC7W99ClhDoZb0L/p4++OXJQHCWx1e+r4E5qfWv06Q8fLjnKfsmn9l7QicS1p/2f6 TCiuiVrmKV6ytXuL8bqfI5sNEY1Cf8nahbtShSx97GmIQr1kpE756Oza92Ij9mhdxzrB BAjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kQZ1gsfj; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h12si7283681eds.421.2020.06.14.12.19.04; Sun, 14 Jun 2020 12:19:27 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kQZ1gsfj; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727795AbgFNTPV (ORCPT + 99 others); Sun, 14 Jun 2020 15:15:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726648AbgFNTPU (ORCPT ); Sun, 14 Jun 2020 15:15:20 -0400 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B13ECC08C5C2 for ; Sun, 14 Jun 2020 12:15:20 -0700 (PDT) Received: by mail-io1-xd43.google.com with SMTP id i25so15593365iog.0 for ; Sun, 14 Jun 2020 12:15:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wpwnKZ9Z6FevvyoUxw0sdksaS/2sRQ75c+duIaoaZRc=; b=kQZ1gsfj4lQvJR/H6vCmpiIkhHpY1f5kqABWgOdvQibUv+iHS3adjlq7sAmeP7nupv kTuTPf9cEZCfjSzEt5Pwjn2/Y5OJPqcXNKdEiYJ65tNm3lE5S//3/QUChsdLMiH3Ss5m IZmyOEbX7udSeeSl2jFkIBtVbh7C5D3OmB6KXnNmI+Sn5CM5R2Z+pEQJWLd2KrntjvW9 8Eji/AAMtgS44m6p87Bwqpo51mPp2t5RWPvCuujfimgke9S/e5Ft+SqEfO/txsZqyZJQ LELwfOzqwyJJUYpIRnY4sDK8dODhipQ+tSIo4x5CmkOJnQGfk8VKCCiYCKAFYcBZgG/x 1MqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wpwnKZ9Z6FevvyoUxw0sdksaS/2sRQ75c+duIaoaZRc=; b=Xr0jPu1br1LvpxeKiQjvjcYEJ4hj1uWpJlRrT9I7XCQm2wKboxxcT0OBz3XpOxOO/6 zyMPDSw71xcxvvJSXNm9gCorCn91pt219Z9Q5cyceyv7XSsi3py627B3X50WFpjVp3KX hycEAlT7zeQAv9sN2EYdTeVQSUX6QMXaPS9qUrwsQBY/ozEXFGj6d6Va4GKdE3dJjQQx yXRULOg6UFFL4DqN/AcHNP7SOJReys3MPvbNYzdgbTfT0UC7TqR5EgjTWv3LT3EGNRJr LUMdF9Eve6pkpwxvDVb4C+MZmHUc+X5ipDzLasoNXPjz8MuZNUc1U3+RwfZRAG8Ip4Bl hdaQ== X-Gm-Message-State: AOAM533lZfUUNzcRETH6eDTb2k2zdfsub2m1KkuYgAe3xRUjFk00hFg0 XbEKXWf/INArlk08R93vhv9Qsorxx3sbiL/j8cQ= X-Received: by 2002:a02:380d:: with SMTP id b13mr17917547jaa.107.1592162118632; Sun, 14 Jun 2020 12:15:18 -0700 (PDT) MIME-Version: 1.0 References: <20200614065251.94106-1-navid.emamdoost@gmail.com> In-Reply-To: From: Navid Emamdoost Date: Sun, 14 Jun 2020 14:15:07 -0500 Message-ID: Subject: Re: [PATCH] drm/vc4: fix ref count leak in vc4_dsi_encoder_enable To: Andy Shevchenko Cc: Eric Anholt , David Airlie , Daniel Vetter , dri-devel , Linux Kernel Mailing List , Navid Emamdoost , Qiushi Wu , Kangjie Lu , Stephen McCamant Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 14, 2020 at 7:32 AM Andy Shevchenko wrote: > > On Sun, Jun 14, 2020 at 9:55 AM Navid Emamdoost > wrote: > > > > in vc4_dsi_encoder_enable, the call to pm_runtime_get_sync increments > > the counter even in case of failure, leading to incorrect > > ref count. In case of failure, decrement the ref count before returning. > > ... > > > +out: > > + pm_runtime_put(dev); > > Better to use pm_runtime_put_noidle() for error case. > And here is a change of semantics, i.e. before your patch there was no > put at all. How did you test this? I had no way to test this but looked to me like a miscalculation of ref count when there is a get and an error happens then the ref count should be restored. Does that look incorrect? > > -- > With Best Regards, > Andy Shevchenko -- Navid.