From patchwork Sun Dec 23 22:24:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1907401 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id A1568DF25A for ; Sun, 23 Dec 2012 22:22:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752229Ab2LWWWq (ORCPT ); Sun, 23 Dec 2012 17:22:46 -0500 Received: from perceval.ideasonboard.com ([95.142.166.194]:54262 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752064Ab2LWWWp (ORCPT ); Sun, 23 Dec 2012 17:22:45 -0500 Received: from avalon.ideasonboard.com (unknown [91.178.42.120]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 52101359DC; Sun, 23 Dec 2012 23:22:44 +0100 (CET) From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: hans.verkuil@cisco.com Subject: [RFC/PATCH] v4l2-compliance: Reject invalid ioctl error codes Date: Sun, 23 Dec 2012 23:24:04 +0100 Message-Id: <1356301444-10191-1-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 1.7.8.6 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The recent uvcvideo regression that broke pulseaudio/KDE (see commit 9c016d61097cc39427a2f5025bdd97ac633d26a6 in the mainline kernel) was caused by the uvcvideo driver returning a -ENOENT error code to userspace by mistake. To make sure such regressions will be caught before reaching users, test ioctl error codes to make sure they're valid. Signed-off-by: Laurent Pinchart --- utils/v4l2-compliance/v4l2-compliance.cpp | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) A white list of valid error codes might be more appropriate. I can fix the patch accordingly, but I'd like a general opinion first. diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp index 1e4646f..ff1ad9b 100644 --- a/utils/v4l2-compliance/v4l2-compliance.cpp +++ b/utils/v4l2-compliance/v4l2-compliance.cpp @@ -112,6 +112,13 @@ int doioctl_name(struct node *node, unsigned long int request, void *parm, const fail("%s returned %d instead of 0 or -1\n", name, retval); return -1; } + + /* Reject invalid error codes */ + switch (errno) { + case ENOENT: + fail("%s returned invalid error %d\n", name, errno); + break; + } return e; }