Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1636855/?format=api
{ "id": 1636855, "url": "http://patchwork.ozlabs.org/api/patches/1636855/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20220530090911.28169-1-pali@kernel.org/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20220530090911.28169-1-pali@kernel.org>", "list_archive_url": null, "date": "2022-05-30T09:09:11", "name": "[v2] ubifs: Fix reference count leak in ubifsumount", "commit_ref": "69ca709d0fb001851f443b0b744c6d65bb6c22c1", "pull_url": null, "state": "accepted", "archived": false, "hash": "538e40260ff70d64a7ba3ebb2350dc5717ecae59", "submitter": { "id": 78810, "url": "http://patchwork.ozlabs.org/api/people/78810/?format=api", "name": "Pali Rohár", "email": "pali@kernel.org" }, "delegate": { "id": 3651, "url": "http://patchwork.ozlabs.org/api/users/3651/?format=api", "username": "trini", "first_name": "Tom", "last_name": "Rini", "email": "trini@ti.com" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20220530090911.28169-1-pali@kernel.org/mbox/", "series": [ { "id": 302480, "url": "http://patchwork.ozlabs.org/api/series/302480/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=302480", "date": "2022-05-30T09:09:11", "name": "[v2] ubifs: Fix reference count leak in ubifsumount", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/302480/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1636855/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1636855/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "bilbo.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=TNP9qhhR;\n\tdkim-atps=neutral", "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>)", "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=kernel.org", "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de", "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.b=\"TNP9qhhR\";\n\tdkim-atps=neutral", "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=kernel.org", "phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org" ], "Received": [ "from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby bilbo.ozlabs.org (Postfix) with ESMTPS id 4LBV3t6tCQz9s0r\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 30 May 2022 19:10:01 +1000 (AEST)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 2A489842A1;\n\tMon, 30 May 2022 11:09:46 +0200 (CEST)", "by phobos.denx.de (Postfix, from userid 109)\n id 590E0842A6; Mon, 30 May 2022 11:09:44 +0200 (CEST)", "from dfw.source.kernel.org (dfw.source.kernel.org\n [IPv6:2604:1380:4641:c500::1])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id AC31984282\n for <u-boot@lists.denx.de>; Mon, 30 May 2022 11:09:41 +0200 (CEST)", "from smtp.kernel.org (relay.kernel.org [52.25.139.140])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by dfw.source.kernel.org (Postfix) with ESMTPS id 1CD6F60F3E\n for <u-boot@lists.denx.de>; Mon, 30 May 2022 09:09:40 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id 62880C385B8\n for <u-boot@lists.denx.de>; Mon, 30 May 2022 09:09:39 +0000 (UTC)", "by pali.im (Postfix)\n id D6F85731; Mon, 30 May 2022 11:09:36 +0200 (CEST)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,\n DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,\n SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no\n version=3.4.2", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n s=k20201202; t=1653901779;\n bh=bYGz2kmZV/ENGZu8CPFQLx3L5F/0DgkSAnBOhy/Z4+E=;\n h=From:To:Subject:Date:In-Reply-To:References:From;\n b=TNP9qhhRNzlqhkM7wZSWcX78YYZan8FqfhYqtLQpwTz2SumMAmFOj9pO8/9Rde2V7\n 7Vv8DEVdEvTOLDhcuRUB9XJPEovDwmj7GW9+t48vzmeyNqzM4fPe+AVYjo7ZL2fTev\n /jCXTEIva1LFKpUsIp7hXK7wOLb8B7Vqx6L3PzAs+m8x616Vh63Lcfk8avTxuGs3ur\n a3AwcJ6D6VWKabNqv4qU/L4YkX+YEF0mV/RAaXT0WgoZwv3blnkKP5h1AFfxi6MKD8\n hi2562KmbdF9TSvP6qosOUhgdhSUi3xMDWHdJU72MNkOfxb1xcOyNn/Q0Z5BH3ustU\n kmbu+mauV39Fg==", "From": "=?utf-8?q?Pali_Roh=C3=A1r?= <pali@kernel.org>", "To": "u-boot@lists.denx.de", "Subject": "[PATCH v2] ubifs: Fix reference count leak in ubifsumount", "Date": "Mon, 30 May 2022 11:09:11 +0200", "Message-Id": "<20220530090911.28169-1-pali@kernel.org>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20220523213550.14570-1-pali@kernel.org>", "References": "<20220523213550.14570-1-pali@kernel.org>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.39", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>", "List-Post": "<mailto:u-boot@lists.denx.de>", "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>", "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>", "X-Virus-Scanned": "clamav-milter 0.103.5 at phobos.denx.de", "X-Virus-Status": "Clean" }, "content": "Original ubifs code was designed that after ubifs_umount() call it is\nrequired to also call ubi_close_volume() which closes underlying UBI\nvolume. But U-Boot ubifs modification have not implemented it properly\nwhich caused that ubifsumount command contains resource leak. It can be\nobserved by calling simple sequence of commands:\n\n => ubi part mtd2\n ubi0: attaching mtd2\n ...\n => ubifsmount ubi0\n => ubifsumount\n Unmounting UBIFS volume rootfs!\n => ubi detach\n ubi0 error: ubi_detach_mtd_dev: ubi0 reference count 1, destroy anyway\n ubi0: detaching mtd2\n ubi0: mtd2 is detached\n\nFix this issue by calling ubi_close_volume() and mutex_unlock() in\ndirectly in ubifs_umount() function before freeing U-Boot's global\nubifs_sb. And remove duplicate calls of these two functions in remaining\nplaces. Note that when ubifs_umount() is not called then during error\nhandling is still needed to call ubi_close_volume() and mutex_unlock.\n\nWith this change ubifsumount command does not throw that error anymore:\n\n => ubi part rootfs\n ubi0: attaching mtd2\n ...\n => ubifsmount ubi0\n => ubifsumount\n Unmounting UBIFS volume rootfs!\n => ubi detach\n ubi0: detaching mtd2\n ubi0: mtd2 is detached\n\nSigned-off-by: Pali Rohár <pali@kernel.org>\n---\nChanges in v2:\n* Fix error handling in ubifs_fill_super()\n---\n fs/ubifs/super.c | 7 ++++++-\n 1 file changed, 6 insertions(+), 1 deletion(-)", "diff": "diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c\nindex e3a4c0bca270..034c41a70356 100644\n--- a/fs/ubifs/super.c\n+++ b/fs/ubifs/super.c\n@@ -1757,6 +1757,8 @@ void ubifs_umount(struct ubifs_info *c)\n \tkfree(c->bottom_up_buf);\n \tubifs_debugging_exit(c);\n #ifdef __UBOOT__\n+\tubi_close_volume(c->ubi);\n+\tmutex_unlock(&c->umount_mutex);\n \t/* Finally free U-Boot's global copy of superblock */\n \tif (ubifs_sb != NULL) {\n \t\tfree(ubifs_sb->s_fs_info);\n@@ -2058,9 +2060,9 @@ static void ubifs_put_super(struct super_block *sb)\n \tubifs_umount(c);\n #ifndef __UBOOT__\n \tbdi_destroy(&c->bdi);\n-#endif\n \tubi_close_volume(c->ubi);\n \tmutex_unlock(&c->umount_mutex);\n+#endif\n }\n #endif\n \n@@ -2327,6 +2329,9 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)\n \n out_umount:\n \tubifs_umount(c);\n+#ifdef __UBOOT__\n+\tgoto out;\n+#endif\n out_unlock:\n \tmutex_unlock(&c->umount_mutex);\n #ifndef __UBOOT__\n", "prefixes": [ "v2" ] }