Show a patch.

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

{
    "id": 17725,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/17725/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17725/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20221028115200.8138-2-naush@raspberrypi.com>",
    "date": "2022-10-28T11:51:59",
    "name": "[libcamera-devel,v1,1/2] libcamera: v4l2_videodevice: Guard against releasing unallocated buffers",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "322fd0d6a436783d189c9167327b8d1c76cdc43b",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/17725/mbox/",
    "series": [
        {
            "id": 3585,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3585/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3585",
            "date": "2022-10-28T11:51:58",
            "name": "Buffer cleanup fixes",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3585/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17725/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17725/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 4993FC3285\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 28 Oct 2022 11:52:08 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6DE3862FD7;\n\tFri, 28 Oct 2022 13:52:06 +0200 (CEST)",
            "from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com\n\t[IPv6:2a00:1450:4864:20::32b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2FA7B61F4A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 Oct 2022 13:52:05 +0200 (CEST)",
            "by mail-wm1-x32b.google.com with SMTP id\n\ti5-20020a1c3b05000000b003cf47dcd316so6444738wma.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 Oct 2022 04:52:05 -0700 (PDT)",
            "from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\ta5-20020adffb85000000b002366fb99cdasm3441686wrr.50.2022.10.28.04.52.03\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 28 Oct 2022 04:52:04 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1666957926;\n\tbh=cMfI4eFnCXgAVzc0Q4WC2zWs21d3htd644CLmrZOmi4=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=z8lGT+1ykszJw3n5+z2GVDFmH2EsrwaduSwZH0Kt0aRZjLlWmfSCDBYxXpj7gEy3e\n\tr8vgbOrYELxDXhXm5o2Mq679mSdX02X41/TB5NoE15NXPPHRborBihUXtXCb7LSU5x\n\tdFYsFkOiskRCQc+ObLjFi6+35Gmshh4rV+gW+60I9vgEciTyhT0+IEN8LFgbZIj++M\n\tdP0DTTtcA1BuvgPyAi2XPYV2KGAAqU4BRhNBeVp9ti1PO7Hztlzh8jPp9Eq9PfeS/9\n\tLvxTWs+YZPAcM+f3BYICeBXZau6A5xPU1lG1pXNOw55Wt+kZ0eJWhWYbAUjQeWlajx\n\tcKSMWxMBbq3oA==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=VYUNz4rxyQseG9GQx4W+HnN+aeqxFCgBIu6OdPykKlQ=;\n\tb=HvYbNGL/r1CAD7b69+NRNBPRxdGy+Qs9QkbsoQXKHwru4AdjdtLjor5SeYn9AIjwVx\n\t3+89wfsiPMw77gxYC97wNqkdRBJ0HIe/0zuGVt037IkJn3erZVFCM2pPeUZQKtfaKAVS\n\t0FsuZOlCUxJ3nf4rUNhVmPUWdVadD6gBCzRYDs2W8Ra7ETB4psrY0kLtkOpxFUkBGLMD\n\tL+ARGMG/xiSg+N0yzXsmkxBksNJm5aNySj93RtT/+9Pny8BvSZjnFNJtRM2jS859vjD7\n\twN6hUvRxjAaYqHY4q8E9KeVp3uW/QE9v0pRgtR+IBxGAX9DTT3SADzusYmkjE5S+Y3/b\n\tUWBg=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"HvYbNGL/\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=VYUNz4rxyQseG9GQx4W+HnN+aeqxFCgBIu6OdPykKlQ=;\n\tb=kxPtUimmnurK073PtfPj48VvsgBDMiSGUdHBAJUIPS+VcXRMHIWLOxOQd/7tsGzQr0\n\tN81W6j4uYJMBNkYSFGjwQjdF24y6PX6D2pRsrPuf0H8433RWSom2VRlVSE2KX+ZlJ6Hc\n\tcxXK3oIMf+JG1lO5Yd06MpMavFQDd+2pvJcYJF3AxWcQb6H4xTxsVixW4nYJhdHlQ7nR\n\ts8L2EZLb0hxqsZNdxPmwkTwteugntLjLJZTFBvDRC8F8lGQKuW+mEiLWEd81RuJ3N1EX\n\t71AAvLI+qt9Wm9svCcO6h47LDcKnvphvXJbMVznNzAYzPCTzaOuebAs6MQgjW9pOkGB/\n\t2BAw==",
        "X-Gm-Message-State": "ACrzQf3CvIB3IEPXXUI86mzHxs92Mubh4FnRx3s6BltTNx25i3392VbE\n\t8/ZSy1DMRAMLXEpDKnqvPHHTbDVKlWAWTw==",
        "X-Google-Smtp-Source": "AMsMyM7MLijwbnw3BjiT0eEf3x/5M9pMRwFtYswI2kJbCfrexKPiAxQc71M4lYTiSyXCshzjxe4MgQ==",
        "X-Received": "by 2002:a1c:2987:0:b0:3c6:c0cc:b4c2 with SMTP id\n\tp129-20020a1c2987000000b003c6c0ccb4c2mr8963366wmp.56.1666957924533; \n\tFri, 28 Oct 2022 04:52:04 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 28 Oct 2022 12:51:59 +0100",
        "Message-Id": "<20221028115200.8138-2-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20221028115200.8138-1-naush@raspberrypi.com>",
        "References": "<20221028115200.8138-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v1 1/2] libcamera: v4l2_videodevice: Guard\n\tagainst releasing unallocated 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": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Naushir Patuck <naush@raspberrypi.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "releaseBuffers() unconditionally calls ioctl(REQBUFS, 0) to release device\nbuffer allocations through the close() and class destructor functions. If\nanother libcamera process is running concurrently with a different sensor, it\nwould cause the ioctl to fail in the kernel because the buffer queue is owned\nowned by the other process. This in turn would cause libcamera to generate an\nerror log message.\n\nFix this by ensuring the releaseBuffers() only calls ioctl(REQBUFS, 0) if there\nhave been buffers previously allocated by the device. This is done by testing\nthe presense of the V4L2BufferCache in the object.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/libcamera/v4l2_videodevice.cpp | 3 +++\n 1 file changed, 3 insertions(+)",
    "diff": "diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex e30858c9fa02..ed446c25e45f 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -1533,6 +1533,9 @@ int V4L2VideoDevice::importBuffers(unsigned int count)\n  */\n int V4L2VideoDevice::releaseBuffers()\n {\n+\tif (!cache_)\n+\t\treturn;\n+\n \tLOG(V4L2, Debug) << \"Releasing buffers\";\n \n \tdelete cache_;\n",
    "prefixes": [
        "libcamera-devel",
        "v1",
        "1/2"
    ]
}