Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932238AbcLLUmY (ORCPT ); Mon, 12 Dec 2016 15:42:24 -0500 Received: from mail.fireflyinternet.com ([109.228.58.192]:57612 "EHLO fireflyinternet.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753008AbcLLUmW (ORCPT ); Mon, 12 Dec 2016 15:42:22 -0500 X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Date: Mon, 12 Dec 2016 20:42:13 +0000 From: Chris Wilson To: Gustavo Padovan Cc: 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: <20161212204213.GK20316@nuc-i3427.alporthouse.com> Mail-Followup-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" References: <1481571668-14094-1-git-send-email-gustavo@padovan.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1481571668-14094-1-git-send-email-gustavo@padovan.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 614 Lines: 19 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. -Chris -- Chris Wilson, Intel Open Source Technology Centre