Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp4258910ybh; Tue, 17 Mar 2020 15:32:56 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuTD5HTUP8yG9nYJfIie8+AzHOYgoR6uUKg+b9alUHMx6nVcWL/AM6Fod/CI5qx5nGcclL4 X-Received: by 2002:a05:6830:134b:: with SMTP id r11mr1230666otq.305.1584484375984; Tue, 17 Mar 2020 15:32:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584484375; cv=none; d=google.com; s=arc-20160816; b=bjneVdJMccZGANQVYOMLTCgLUZ+hja5O7nM9xtoLLBePKwknN1Cqc8HwhAUfM9OdI2 gC6/jrkfwt27VfMJM1bheW2fl9lkTiSYK1vypW9Qd/vRnfA9eN/uSx9PZTCdPJOaax8q qj6JH5zechwBd3bXq9IcUvFEO8AuhsmDrlbqaP0lLxb2oTESCh9hvTRgogvSIbOXEIVN B3gqGpQ8FrLv4Dz36YtzwllIaKRXZS44B14ax+XfDeiaSAvDjyY6kCO0xSOvVKkypsZH aQZcbB8I7wnVZu423rqOtJrjuYdkcdXK53STJxWuYL9zfDHggpkKhiyx6IfeAdzSLu4x IPJA== 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=+bEIoiMS77J8OafdTSe8ka9CicGNma8msO19PpTMGGU=; b=RVU8UmdOKmCV8wF8FXriE+Ku1lDC+U5seLL3Es9zi3DPMRmqEVXv+k3ujd2eunIucs YZN63mJjlUVRS/LExMzL2kv698JHp///kbBz8gWqMadomYfetd2fH8kWPEjyRKIbW1EK +2SRmFRY0HYFVsA4bWdHpkrUQQFJ/Ck+05B1XITmkJUKIQK5mEnGTa/9CV3bOvBhFgVc Ae2Jt2Bn0mgTtj9eVViKff5o49Pphpvc4G7GKM143ep3uPI3/uELGH4manomA5BombTU jjTJr07h7qRvr7gQZd0ngHpztdgD41TR6uX/04u5Q5FTLary2Bi/R94w6YKqvmVyWwR+ otRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XsH2EWdl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id e16si2505932ote.190.2020.03.17.15.32.44; Tue, 17 Mar 2020 15:32:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XsH2EWdl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727223AbgCQW3P (ORCPT + 99 others); Tue, 17 Mar 2020 18:29:15 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:37645 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726735AbgCQW3O (ORCPT ); Tue, 17 Mar 2020 18:29:14 -0400 Received: by mail-io1-f67.google.com with SMTP id q9so2922269iod.4 for ; Tue, 17 Mar 2020 15:29:13 -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=+bEIoiMS77J8OafdTSe8ka9CicGNma8msO19PpTMGGU=; b=XsH2EWdlmo2FWYBvtVzOdR0HVND74GUX1SiRcRc2SzJBbtTrGbjYewhWERHT/9VuYy A4XNY27GZ1DVtb9WRskC+VR05HY0eczzAetwxDGll+aZksKxI+TWbg9aX1VWhkpqpfsH m6gidwY8k1vpxeamp1ZZcJD6NUuk+8sCIUkRDPu+r3RemGAoJZjuHSKST3v730/AWWFC K9x+A4dB7auiUS6/lQtdr7jg4wboz4ax4v7qxCuFcf9ipmsLLV4+KaQjSzEpcLPohI7h LUFX+r7dRDYMBqgdgxgz4P7DCg3piPX685dY1iSXONS0d7/Jr+NOTax5HoUTvl0lqIWo nsVg== 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=+bEIoiMS77J8OafdTSe8ka9CicGNma8msO19PpTMGGU=; b=b5j0C0GigMBRanKyg03eOmG4pCkBggb8oLtIfgrtRsvifF48RdImtdseBtLLvPKGlf PktDIOfK4A11xQ5m6lOYUS6Ubxg21VfmcBZwwZe/vHgc+E/mLQcGa6TCDLHkd1UXdzvz kPKQU9e6rHmyMmFi1B7SKPoMRf++yPng4/SbinUkj95kR4/YZHR04arZun0TD3GMD+CL eK/xJp81rOnRUAFUMXbsBhqtigoYSQUn+utQkUQusuxTqz3Bi5hrLEMJqYeVtcjKV7cg QltHYxMRisehLNr3yJZVXpoqL05Cy9CUoNZKB+2a5JPuBvGh8tR3kSJhUD8YlebDtQU9 hnKQ== X-Gm-Message-State: ANhLgQ3LidetTuW9Sralsq20ilyY4r6bk4gFOKDzs0GaO+1LgTiyAYl+ puSukwoWyMsUfQ7xDTS0MB6EHBJxh0KIYYcBIQA= X-Received: by 2002:a02:9f90:: with SMTP id a16mr1501965jam.61.1584484152847; Tue, 17 Mar 2020 15:29:12 -0700 (PDT) MIME-Version: 1.0 References: <1584329768-16119-1-git-send-email-hqjagain@gmail.com> <20200317165729.GQ2363188@phenom.ffwll.local> In-Reply-To: <20200317165729.GQ2363188@phenom.ffwll.local> From: Qiujun Huang Date: Wed, 18 Mar 2020 06:29:02 +0800 Message-ID: Subject: Re: [PATCH] drm/lease: fix WARNING in idr_destroy To: Qiujun Huang , maarten.lankhorst@linux.intel.com, mripard@kernel.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, LKML Cc: Daniel Vetter 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 Wed, Mar 18, 2020 at 12:57 AM Daniel Vetter wrote: > > On Mon, Mar 16, 2020 at 11:36:08AM +0800, Qiujun Huang wrote: > > leases has been destroyed: > > drm_master_put > > ->drm_master_destroy > > ->idr_destroy > > > > so the "out_lessee" needn't to call idr_destroy again. > > > > Reported-and-tested-by: syzbot+05835159fe322770fe3d@syzkaller.appspotmail.com > > Signed-off-by: Qiujun Huang > > --- > > drivers/gpu/drm/drm_lease.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c > > index b481caf..54506c2 100644 > > --- a/drivers/gpu/drm/drm_lease.c > > +++ b/drivers/gpu/drm/drm_lease.c > > @@ -577,11 +577,14 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev, > > > > out_lessee: > > drm_master_put(&lessee); > > + goto err_exit; > > I think this is correct, but also confusioning and inconsistent with the > existing style. Most error cases before drm_lease_create explicit destroy > the idr, except the one for drm_lease_create. Yeah, it is. > > Instead of your patch I'd > - remove the idr_destry from the error unrolling here > - add it the to drm_lease_create error case > - add a comment above the call to drm_lease_crete that it takes ownership > of the lease idr > > Can you pls respin and retest to make sure that patch is still correct? I get that, thanks. > > Thanks, Daniel > > > > > out_leases: > > - put_unused_fd(fd); > > idr_destroy(&leases); > > > > +err_exit: > > + put_unused_fd(fd); > > + > > DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl failed: %d\n", ret); > > return ret; > > } > > -- > > 1.8.3.1 > > > > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch