From patchwork Fri Jan 26 12:43:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 10185545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A303D601D5 for ; Fri, 26 Jan 2018 12:43:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 983B929068 for ; Fri, 26 Jan 2018 12:43:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D4CD290E7; Fri, 26 Jan 2018 12:43:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4490729068 for ; Fri, 26 Jan 2018 12:43:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752021AbeAZMng (ORCPT ); Fri, 26 Jan 2018 07:43:36 -0500 Received: from lb2-smtp-cloud9.xs4all.net ([194.109.24.26]:44920 "EHLO lb2-smtp-cloud9.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751906AbeAZMna (ORCPT ); Fri, 26 Jan 2018 07:43:30 -0500 Received: from marune.fritz.box ([80.101.105.217]) by smtp-cloud9.xs4all.net with ESMTPA id f3Lre6Mt27Jdrf3LtexuMJ; Fri, 26 Jan 2018 13:43:29 +0100 From: Hans Verkuil To: linux-media@vger.kernel.org Cc: Daniel Mentz , Hans Verkuil Subject: [PATCH 11/12] v4l2-compat-ioctl32.c: don't copy back the result for certain errors Date: Fri, 26 Jan 2018 13:43:26 +0100 Message-Id: <20180126124327.16653-12-hverkuil@xs4all.nl> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180126124327.16653-1-hverkuil@xs4all.nl> References: <20180126124327.16653-1-hverkuil@xs4all.nl> X-CMAE-Envelope: MS4wfGm4XD2UuP4MRAP6Oz4O99DqrFWZbvghu2mVlvoYSnWCH2cVvlF6q8bmOl3eVh1GolfYqE0u8ffMxOSZGZO8WB+E79RODo4IOfb5278gr+wRHFfdB9Xk q3iyCAUJnDJYbl7DeWSiA0wZVwqFv2D2Oy1rlmlBqRTFPWZrHzEQeiLvUrcMVyAF3gWmY29gfvSlWX1bRlM1rD1TgNEhYQeC+cYIMAIIORyq94UqvoUyUAJM jCAsLTutF4o5QWeMjI3eyg== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hans Verkuil Some ioctls need to copy back the result even if the ioctl returned an error. However, don't do this for the error codes -ENOTTY, -EFAULT and -ENOIOCTLCMD. It makes no sense in those cases. Signed-off-by: Hans Verkuil Acked-by: Sakari Ailus --- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index 790473b45a21..2aa9b43daf60 100644 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c @@ -966,6 +966,9 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar set_fs(old_fs); } + if (err == -ENOTTY || err == -EFAULT || err == -ENOIOCTLCMD) + return err; + /* Special case: even after an error we need to put the results back for these ioctls since the error_idx will contain information on which control failed. */