From patchwork Wed Mar 6 21:17:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 10841791 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7A05B1669 for ; Wed, 6 Mar 2019 21:18:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 671782DF07 for ; Wed, 6 Mar 2019 21:18:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B73A2E183; Wed, 6 Mar 2019 21:18:04 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,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 100D42DF07 for ; Wed, 6 Mar 2019 21:18:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726127AbfCFVSD (ORCPT ); Wed, 6 Mar 2019 16:18:03 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:34178 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725793AbfCFVSD (ORCPT ); Wed, 6 Mar 2019 16:18:03 -0500 Received: by mail-wm1-f65.google.com with SMTP id o10so5312580wmc.1 for ; Wed, 06 Mar 2019 13:18:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=QlpOK6oJV8oeAwbvelcizyRnTulOUmA1Vc7OVMdeGbw=; b=kjzKhUb5ArxHajVcLgPkvtV85ISXItpsuZI97q94i+NS4TMHQKSyg2Z+0B8V7hhlH9 br5icVmjkg/tRFDG0t0Xc2ZD4pST4jcpVQrRLpP8lC1C8S1gw+I2SRlhLJm3BOEQeFIz /ROvLRoP1Hm0R4W04QbcRcC68jUBjyFtqmUyEune0YUfRdQimCDQK7vWvbo4TP2ZQzUY EzNYm+eKpNUEGi5Cr9Cg5XcQL1Y+FoML3yV6glY4xYlqed/Fnsoyb0kIt6fFyUU9F7c0 vSmbbgBCsZzn/pyzRHoac5b14ToReOxdA2SV5+swTJV9Jqm3D3gE/rq0ttSNDkB+7egz S41Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=QlpOK6oJV8oeAwbvelcizyRnTulOUmA1Vc7OVMdeGbw=; b=PxmLH7EET0gWl4qUnvOenJ6j1RrprvVgbIOoK/M+jyT4J+4DaMhwdVmvpFE63zw9ZQ feGcaFDYcJ9Wd4rOMv1Zk3guLgSwrRLo/ZaMRt1NjVjxUAkWFrq58Q3/S6g86vMxvQd4 hFpA1NtgYNs+4DSpiXbPKgv8t2M52q+Z1C8EkYEhGmIB8fNT2NSOPuMgiudINsOSTe4y hz8ddToP2g7/tzYNF3mC8OuNqSnyDRxhaDenBC2gOBMFMGZQo8U7y/nJm2gx9exCAoEO GOzLtZ76/F4m8zO1z88gkbp/5tCo0jXXMemooHBPbPAr63tx6fSbHGHyx7vuYu/mg0FK 0aMQ== X-Gm-Message-State: APjAAAVRdOw1jlV8YDCNDVSDGhY9mwohn5tbCuIAKCNb2s2Zr/mh6+Lr likzMx/GFT+chqRP6itwA7UPORa56/k= X-Google-Smtp-Source: APXvYqykJnkx87TNkSRpWM8n2GOtqRF7lKVCThMYNqo9HdkVhH9ZyXzz1y0331sz1ozPJ4bV7LuzCQ== X-Received: by 2002:a1c:b40b:: with SMTP id d11mr3848796wmf.80.1551907080604; Wed, 06 Mar 2019 13:18:00 -0800 (PST) Received: from ubuntu.home ([77.124.117.239]) by smtp.gmail.com with ESMTPSA id c2sm5252495wrt.93.2019.03.06.13.17.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Mar 2019 13:18:00 -0800 (PST) From: Dafna Hirschfeld To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, helen.koike@collabora.com, Dafna Hirschfeld Subject: [v4l-utils PATCH v5 1/6] v4l2-ctl: in streaming_set_m2m, close file pointers upon error Date: Wed, 6 Mar 2019 13:17:47 -0800 Message-Id: <20190306211752.15531-1-dafna3@gmail.com> X-Mailer: git-send-email 2.17.1 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 In streaming_set_m2m, make sure to close all file pointers and file descriptors before returning. Signed-off-by: Dafna Hirschfeld --- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index 0eda8449..ee84abbe 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -2141,18 +2141,19 @@ static void streaming_set_m2m(cv4l_fd &fd, cv4l_fd &exp_fd) if (options[OptStreamDmaBuf]) { if (exp_q.reqbufs(&exp_fd, reqbufs_count_cap)) - return; + goto done; exp_fd_p = &exp_fd; } if (options[OptStreamOutDmaBuf]) { if (exp_q.reqbufs(&exp_fd, reqbufs_count_out)) - return; + goto done; if (out.export_bufs(&exp_fd, exp_fd.g_type())) - return; + goto done; } stateful_m2m(fd, in, out, file[CAP], file[OUT], exp_fd_p); +done: if (options[OptStreamDmaBuf] || options[OptStreamOutDmaBuf]) exp_q.close_exported_fds();