Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3308508imu; Sun, 11 Nov 2018 12:04:52 -0800 (PST) X-Google-Smtp-Source: AJdET5egZ+esQLsx3Vwe6kzoqPYOQlCCUDzhlrVt5512ffZ+HrLaeCPjwaMV79+MQwMFd3TwG27L X-Received: by 2002:a63:2744:: with SMTP id n65mr14848611pgn.65.1541966692202; Sun, 11 Nov 2018 12:04:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541966692; cv=none; d=google.com; s=arc-20160816; b=gEv2qhJx8iroCD+xh02YvsWuUIbFcqSJmGymv9DYmdFb2pHKVaeXmjlhYzjlVjihso cPeAWkPlps/Kax7odFO4R8o1zYEw7s4HTvz6iy7ToesaquHWb7B0iuqjs/SYbuF9FKKk +GFyEUy70TEWrpJwf6eU+DUmqR+0vB8bkyUU8z6eYkJl9vylodmKXlHrGZQgT6QhqGiy qM2Xq3/Ho0J7nSs5XjEievtZjHxgxpABKcRdhk69T7HqUuxg2rrWQmsfI5mhlsRFmlFa gMQ8FtwTv6dfRGAFiz1eNUQUCsnedPcjSnvl9ONJCUxB688k7AQeF7uJX+svU2GL7xL4 QSaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=4rFHQhO+pGfEkO0SSTWSJn8KFUA1b4C15+gLijgkCC4=; b=s5RETYdOYSQtYuXThUABQAm8LvSxEUa9eVkHWJJcm7PO2Z3UMBHjDzZJQvbXNbDjYO OTqpxqbwS/RTCY8ao3ukpKlMFAMW5Foy7Jh7Bj+x4iqfjL0YQXRUEp70QJhOoZclH8E9 j5duYdsAVxcva3C2wRl2QwLDn2el9yF45aD7yRanZk8QqEAWtoDhWT4mHJvJyO0XStjP Gwzj0a08VKVboGbCazftqjISl2orrwd7cO00tM/iDFlRE40VE60bc9y3I6xuQ+DSMl4R LhK2I7S0mdPhi9QVZg/RzygZX4D0uSQeReBStXP2AqS6IR/jV8TuXsUh5KvHsh1BDT3N Qdpw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v1-v6si14802541plo.134.2018.11.11.12.04.36; Sun, 11 Nov 2018 12:04:52 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730798AbeKLFw4 (ORCPT + 99 others); Mon, 12 Nov 2018 00:52:56 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:51078 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730697AbeKLFsb (ORCPT ); Mon, 12 Nov 2018 00:48:31 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvsq-0000oM-Ks; Sun, 11 Nov 2018 19:59:00 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsW-0001jm-RU; Sun, 11 Nov 2018 19:58:40 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Sean Paul" , "Nicholas Mc Guire" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 260/366] drm: re-enable error handling In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Nicholas Mc Guire commit d530b5f1ca0bb66958a2b714bebe40a1248b9c15 upstream. drm_legacy_ctxbitmap_next() returns idr_alloc() which can return -ENOMEM, -EINVAL or -ENOSPC none of which are -1 . but the call sites of drm_legacy_ctxbitmap_next() seem to be assuming that the error case would be -1 (original return of drm_ctxbitmap_next() prior to 2.6.23 was actually -1). Thus reenable error handling by checking for < 0. Signed-off-by: Nicholas Mc Guire Fixes: 62968144e673 ("drm: convert drm context code to use Linux idr") Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/1531571532-22733-1-git-send-email-hofrat@osadl.org Signed-off-by: Ben Hutchings --- drivers/gpu/drm/drm_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/drm_context.c +++ b/drivers/gpu/drm/drm_context.c @@ -316,7 +316,7 @@ int drm_addctx(struct drm_device *dev, v ctx->handle = drm_ctxbitmap_next(dev); } DRM_DEBUG("%d\n", ctx->handle); - if (ctx->handle == -1) { + if (ctx->handle < 0) { DRM_DEBUG("Not enough free contexts.\n"); /* Should this return -EBUSY instead? */ return -ENOMEM;