Show a patch.

GET /api/patches/18604/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 18604,
    "url": "https://patchwork.libcamera.org/api/patches/18604/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18604/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20230505161346.25489-1-mail@eliasnaur.com>",
    "date": "2023-05-05T16:13:46",
    "name": "[libcamera-devel,v2] libcamera: v4l2_videodevice: Use O_CLOEXEC when exporting DMA buffers",
    "commit_ref": "4c71ec00c2ea5c6acc75e436bf6d24e6861cb66f",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "7ba14f4d137fb685b307d66b163459e06cd35a8e",
    "submitter": {
        "id": 159,
        "url": "https://patchwork.libcamera.org/api/people/159/?format=api",
        "name": "Elias Naur",
        "email": "mail@eliasnaur.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18604/mbox/",
    "series": [
        {
            "id": 3866,
            "url": "https://patchwork.libcamera.org/api/series/3866/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3866",
            "date": "2023-05-05T16:13:46",
            "name": "[libcamera-devel,v2] libcamera: v4l2_videodevice: Use O_CLOEXEC when exporting DMA buffers",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3866/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18604/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18604/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id ADE2CC0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  5 May 2023 16:14:01 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E3C4C633AC;\n\tFri,  5 May 2023 18:14:00 +0200 (CEST)",
            "from mail-vk1-xa30.google.com (mail-vk1-xa30.google.com\n\t[IPv6:2607:f8b0:4864:20::a30])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5C7E7627DE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  5 May 2023 18:13:59 +0200 (CEST)",
            "by mail-vk1-xa30.google.com with SMTP id\n\t71dfb90a1353d-44fa585ad7aso1326950e0c.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 05 May 2023 09:13:59 -0700 (PDT)",
            "from localhost.localdomain ([190.53.13.8])\n\tby smtp.gmail.com with ESMTPSA id\n\tp68-20020a1f2947000000b00440186078d6sm28599vkp.50.2023.05.05.09.13.56\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 05 May 2023 09:13:57 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1683303240;\n\tbh=t6loezZenFIPDvk0hRSgEhn0+HGR6QhGcUvVgfi8Uf4=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:Cc:From;\n\tb=gWfPkOLNg3fa9OCC/Mvq1QASI1+8LN95nFPb7QzgxXWqAOF5SE8kbmN44CVSlBVjF\n\tbkqC8eT10P9nbBjDsr7ch/O1F/hiZc2SUhQThbbFjEhaxlj9BdbQPR97lOkWPqvrbD\n\tUl5qNR/WGKt1gbVMX2yLiPN5hztB5tU1yxSCB9fwJDECrcT+68fMoHc5YiYhHv4Q+i\n\tL2qZ2f9d1IhGTlE67AOK2YDoNSN+4YCRhgWEdGXQf8UdELkc+gfyB2XAtNnleUFtDq\n\tf4rR2S91gw6CpxovypW837TU7xq1fojua17FhX0+taHclr6sqLVhMIt6xm8UAxQzsD\n\tBef9pM3VkFZ2Q==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=eliasnaur.com; s=google; t=1683303238; x=1685895238;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=9HwkdLlw9lfRIaJCD+YUSn7bFlXyiKUB17HVmyD4MZ4=;\n\tb=3e9xcDFO3OyqpF3RjcRU4KcIePDjEm6AVeJF3dSFO/rqdpjSEZK+VLDcIz1KrlCjyQ\n\tWa9tzJ1MkIEg4CBKwD9iEjSXTGkiYE5GLAy4Z9Bzf9CXjsV03kuMklxP4OcG+/LsfM/f\n\tvA5+l+TTi1+eQwdTLMzEtb++QZJvbLs4g/H/ijCS5ZGA5yyZO05eIW6NDL9yZYztGESu\n\tr8ABNXsHa+wOjP7Ta6gOxl+hsY8dFIoxRXAwZ4o+jPjx5SAnYizFFT9/SlM2dk9HZi8f\n\tdoJjBiwk/g6y3maVQXG4vZTWIN5q99gVaVA8fdgVe7m8+ouRdVwhWagBXFZok+vPlb5K\n\tY7dA=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=eliasnaur.com\n\theader.i=@eliasnaur.com\n\theader.b=\"3e9xcDFO\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1683303238; x=1685895238;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=9HwkdLlw9lfRIaJCD+YUSn7bFlXyiKUB17HVmyD4MZ4=;\n\tb=j3Wxt5ig0o33/h/byYmHenVID3gpkP8dvwiYs9OKW5s1OfKY/VnWnXsRLR0NoN7Nl6\n\tcUHo3Fw+VOvylgoNyszmaqUSWLwbuLCyEmLkZVU4bbo7sgXyaeFtp4fgwKkwWkgXGohn\n\tGMacpKMlWAE5fC7bMOQvFqmnJL10JClDmV+/xuaSNOjU7IUOtgnufTT1f8OQRX7aSuzt\n\tTN9LONzHKGAUI8NDgf1KbPhtPoO0V/sssgI+B1DkPtn2VATvHWkuxALjbnezfshxPGAV\n\tJNlNrCdLDwPyP3tdMrIE80DKnomiFqLBTx3PvjCzioTfBDHO8pdzLEzua9r6nSGu92UR\n\tosyQ==",
        "X-Gm-Message-State": "AC+VfDyevUWxnUflPMK59sAS4Fhf641o9l/CG+1Sig8/eRXeq6XWpRL+\n\tMpYJA0vP0r5N5qkDzRx6dHLOiitufj8ZyWCpBns=",
        "X-Google-Smtp-Source": "ACHHUZ6AJs8kZFHnxiGd7enR6j1bbS6pidi819ChHiTjj9G/aKcJj+FRHTO9rUiu8kAZNCKCbaiyyQ==",
        "X-Received": "by 2002:a1f:4b04:0:b0:440:d7:da79 with SMTP id\n\ty4-20020a1f4b04000000b0044000d7da79mr686143vka.2.1683303237901; \n\tFri, 05 May 2023 09:13:57 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  5 May 2023 10:13:46 -0600",
        "Message-Id": "<20230505161346.25489-1-mail@eliasnaur.com>",
        "X-Mailer": "git-send-email 2.39.2",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2] libcamera: v4l2_videodevice: Use\n\tO_CLOEXEC when exporting DMA buffers",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "<libcamera-devel.lists.libcamera.org>",
        "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>",
        "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>",
        "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>",
        "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "From": "Elias Naur via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Elias Naur <mail@eliasnaur.com>",
        "Cc": "Elias Naur <mail@eliasnaur.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Files opened internally in libcamera without the O_CLOEXEC file will\nremain open upon a call to one of the exec(3) functions. As exec()\ndoesn't destroy local or global objects, this can lead to various side\neffects. Avoid this by opening file descriptors with O_CLOEXEC for all\ninternal files.\n\nThe O_CLOEXEC flag should also be set when obtaining file handles from\nthe V4L2 VIDIOC_EXPBUF operation, but was missed during the updates to\nboth d942bdc913c5 (\"libcamera: v4l2_device: openat(2) with O_CLOEXEC to\ncleanup after exec(3)\") and 436b38fd89fe (\"libcamera: Open files with\nO_CLOEXEC\").\n\nSet the O_CLOEXEC flag on calls to ioctl(VIDIOC_EXPBUF).\n\nFixes: 436b38fd89fe (\"libcamera: Open files with O_CLOEXEC\")\nSigned-off-by: Elias Naur <mail@eliasnaur.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n\nUpdated commit message as suggested by Kieran (thanks!).\n\n src/libcamera/v4l2_videodevice.cpp | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)",
    "diff": "diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 1051997e..a72ef64d 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -1471,7 +1471,7 @@ UniqueFD V4L2VideoDevice::exportDmabufFd(unsigned int index,\n \texpbuf.type = bufferType_;\n \texpbuf.index = index;\n \texpbuf.plane = plane;\n-\texpbuf.flags = O_RDWR;\n+\texpbuf.flags = O_CLOEXEC | O_RDWR;\n \n \tret = ioctl(VIDIOC_EXPBUF, &expbuf);\n \tif (ret < 0) {\n",
    "prefixes": [
        "libcamera-devel",
        "v2"
    ]
}