Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752723AbcLLVXg (ORCPT ); Mon, 12 Dec 2016 16:23:36 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:43969 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751152AbcLLVXe (ORCPT ); Mon, 12 Dec 2016 16:23:34 -0500 Date: Mon, 12 Dec 2016 19:23:25 -0200 From: Gustavo Padovan To: Chris Wilson , Gustavo Padovan , dri-devel@lists.freedesktop.org, Gustavo Padovan , "open list:DRM DRIVER FOR MSM ADRENO GPU" , open list , "open list:DRM DRIVER FOR MSM ADRENO GPU" Subject: Re: [PATCH] drm/msm: return fence_fd = -1 if gem_submit fails Message-ID: <20161212212325.GD17192@joana> References: <1481571668-14094-1-git-send-email-gustavo@padovan.org> <20161212204213.GK20316@nuc-i3427.alporthouse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161212204213.GK20316@nuc-i3427.alporthouse.com> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 718 Lines: 21 2016-12-12 Chris Wilson : > On Mon, Dec 12, 2016 at 05:41:08PM -0200, Gustavo Padovan wrote: > > From: Gustavo Padovan > > > > Previously we were returning garbage here, fix it by setting it to -1 > > before the first possible point of failure. > > The convention is that on error paths you do not modify user inputs. In > particular, consider EINTR where the usual pattern (e.g. drmIoctl) is > > do { > err = ioctl(fd, SUBMIT, arg); > } while (err == -EINTR); > > If you modify the in fence before you consume it, you can't recreate it > after handling the signal. Right. I didn't know about that convention. So maybe we let it as is. :) Gustavo