Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2479385imm; Mon, 10 Sep 2018 01:38:53 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZpGJhFGDHEZMsU8XaIHcszvlqS4+eHE3TVMadjrxbX7YRVZV1onwgk6ihyCnJJSBjsO30L X-Received: by 2002:a62:d2c4:: with SMTP id c187-v6mr22442938pfg.8.1536568733497; Mon, 10 Sep 2018 01:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536568733; cv=none; d=google.com; s=arc-20160816; b=hktv3xSiBsiDIo/SHLVDLZ7faTHkUnn9ILFoFyVJkRx2M2oN/z9QRA4Wn7Dxosv7vJ /UXcomjSd34IraxKd5PRPsiPwRmKuvSQ2SqD9lWLAtxF4A11IBEq4qiPKYmDQFS2GMjg TPEJYQnsPiBoNj7FqHDk/ikQGc41wTOb7t1mhZMG0yauN2DEZog1s22hJC0okqr/irds w9+aIDGDwom3zxBcU2gPTj5KzQKe22QABVaKzdyPL+pD1P6suoMXpO601lYFw+uGiqVW c+jh7BMUQfGr+6mPR159JOM+4hkajjpTOZlu2YWvE5vOqCzs+4a90Kbm46nSztVn7WdM X3pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=XYTfbmOG8GELgpQQKxRNNJI+Ca0+UBDVxmT7+jifXws=; b=fzOS4IHi+/ZSIRu3xesTRiqC7GGHWfkpHyWLgOogd59UJ9TmgXulZZLpkB3LnNOlgA j50elAEeTmBGw1i4GeewRviJXLKzIzmxitKMHJfv56oGnwcMSoWOcAjVrqhEEwp5tmbu zx6ULepHN302r9GfD/kGK5vWvll3YBfsIxGzRKJErMu+LmhtQkfygv8uNx8w/EtG89Jx +bwVFhAxvs4HIrXYr88R4voe/JQ/2oVoMFUVxSiHxfDSHCoheze4LmiA5HOdMPzOPJSS tllNDqLzCangNC3iKBynTabKlbo8uBal6/wLcYxKQMmbhJGCVWUGdWz347wUY1ppCmkc POdA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 8-v6si15950363pgu.519.2018.09.10.01.38.38; Mon, 10 Sep 2018 01:38:53 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727858AbeIJNa2 (ORCPT + 99 others); Mon, 10 Sep 2018 09:30:28 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40674 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727652AbeIJNa2 (ORCPT ); Mon, 10 Sep 2018 09:30:28 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 216B8807A0C3; Mon, 10 Sep 2018 08:37:33 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-66.ams2.redhat.com [10.36.116.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B7561012335; Mon, 10 Sep 2018 08:37:32 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6E73A4FD7D; Mon, 10 Sep 2018 10:37:31 +0200 (CEST) Date: Mon, 10 Sep 2018 10:37:31 +0200 From: Gerd Hoffmann To: Gert Wollny Cc: linux-kernel@vger.kernel.org, David Airlie , Tomeu Vizoso , Laurent Pinchart , Daniel Vetter Subject: Re: [PATCH v7] Add udmabuf misc device Message-ID: <20180910083731.o4rryvermyighbtp@sirius.home.kraxel.org> References: <1536491489.4810.22.camel@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1536491489.4810.22.camel@collabora.com> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 10 Sep 2018 08:37:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 10 Sep 2018 08:37:33 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, > > + fput(memfd); > > + } > > + memfd = NULL; > Now memfd is NULL > > + buf = dma_buf_export(&exp_info); > > + if (IS_ERR(buf)) { > > + ret = PTR_ERR(buf); > > + goto err_put_pages; > Assume an error occured > > +err_put_pages: > > + while (pgbuf > 0) > > + put_page(ubuf->pages[--pgbuf]); > > +err_free_ubuf: > > + fput(memfd); > Now fput it called with NULL, and in fput this is used in > where the bug is signalled, so I guess fput doesn't accept a null > pointer. Indeed. Already fixed in drm-misc-next. > I'm not sure why you set memfd to NULL at all, because on the following > non-error path it is not used. And in the error path it should not be user either, at least when the error happens *after* exiting the loop, otherwise we would fput twice in the error case. > The other question is of course, why did dma_buf_export fail for me ... What exactly did you try? cheers, Gerd