Patch Detail
Show a patch.
GET /api/1.1/patches/20807/?format=api
{ "id": 20807, "url": "https://patchwork.libcamera.org/api/1.1/patches/20807/?format=api", "web_url": "https://patchwork.libcamera.org/patch/20807/", "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": "<20240805223148.30605-1-kieran.bingham@ideasonboard.com>", "date": "2024-08-05T22:31:48", "name": "libcamera: udev: Catch udev notification errors", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "ddd6ba363c0da11c4dbf1b950102399581c00af6", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/20807/mbox/", "series": [ { "id": 4490, "url": "https://patchwork.libcamera.org/api/1.1/series/4490/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4490", "date": "2024-08-05T22:31:48", "name": "libcamera: udev: Catch udev notification errors", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4490/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/20807/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/20807/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 74136BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 5 Aug 2024 22:31:56 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5AD5E63393;\n\tTue, 6 Aug 2024 00:31:55 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 327506192D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 6 Aug 2024 00:31:53 +0200 (CEST)", "from charm.tail69b4.ts.net\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4EBBB39F;\n\tTue, 6 Aug 2024 00:31:01 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"lI0Uqn0g\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1722897061;\n\tbh=Tkz1eDJMW6bBY9m0s+nSpVlstzfpRJK8osxMpEJW2Bc=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=lI0Uqn0gH55W1WZjVRj34Ext4AqfwbeQZhFxLrBPGpVGp0ny8+m/JY28JbgJsLUxi\n\tI877UVAm9rrsULdbPdr1J2QQxoCS+2yewhtYEPVbPy2AfNv0oJuONRg3gTNkCP1Q+A\n\tq6o1WoXdOTBulQveun8J4POCDXfL6ff1wPQ2LDUI=", "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "To": "libcamera devel <libcamera-devel@lists.libcamera.org>", "Cc": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "Subject": "[PATCH] libcamera: udev: Catch udev notification errors", "Date": "Mon, 5 Aug 2024 23:31:48 +0100", "Message-ID": "<20240805223148.30605-1-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.45.2", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The udev_monitor_receive_device() can return NULL on an error as\ndetailed in the man pages for the function.\n\nThe udevNotify() handler in the DeviceEnumeratorUdev directly uses the\nreturn value of udev_monitor_receive_device() in successive calls to\nprocess the event without having first checked the udev_device.\n\nEnsure we identify, and handle events where the udev_device can not be\nreturned successfully.\n\nBug: https://bugs.libcamera.org/show_bug.cgi?id=230\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\nThis is a proposed fix for the reported CI failure caught by Systemd\nrunners. It's not clear if this failure was an injected failure, startup\nrace or otherwise - but given the documentation of this function states\nit can return null ... it seems valid to null check before passing into\nother APIs especially when a trace is reported directly at this point.\n\nI don't presently have a way to replicate or reproduce the error either,\nbut this patch itself has passed our ci tests (which isn't too\nunexpected as the change is quite minimal otherwise).\n\n\n src/libcamera/device_enumerator_udev.cpp | 6 ++++++\n 1 file changed, 6 insertions(+)", "diff": "diff --git a/src/libcamera/device_enumerator_udev.cpp b/src/libcamera/device_enumerator_udev.cpp\nindex 01c70b6daa82..c6c78651baa0 100644\n--- a/src/libcamera/device_enumerator_udev.cpp\n+++ b/src/libcamera/device_enumerator_udev.cpp\n@@ -332,6 +332,12 @@ int DeviceEnumeratorUdev::addV4L2Device(dev_t devnum)\n void DeviceEnumeratorUdev::udevNotify()\n {\n \tstruct udev_device *dev = udev_monitor_receive_device(monitor_);\n+\tif (!dev) {\n+\t\tLOG(DeviceEnumerator, Warning)\n+\t\t\t<< \"Ignoring notfication received without a device\";\n+\t\treturn;\n+\t}\n+\n \tstd::string_view action(udev_device_get_action(dev));\n \tstd::string_view deviceNode(udev_device_get_devnode(dev));\n \n", "prefixes": [] }