Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/813059/?format=api
{ "id": 813059, "url": "http://patchwork.ozlabs.org/api/patches/813059/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20170912204005.30404-1-robdclark@gmail.com/", "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": "<20170912204005.30404-1-robdclark@gmail.com>", "list_archive_url": null, "date": "2017-09-12T20:40:01", "name": "[U-Boot] fs/fat: fix fatbuf leak", "commit_ref": "725ffdb5cbcc4b8a9726a68cc6ae0713266ba5a9", "pull_url": null, "state": "accepted", "archived": false, "hash": "36aa9d7d7f2b40229b0878f6650a89d4f53697db", "submitter": { "id": 18760, "url": "http://patchwork.ozlabs.org/api/people/18760/?format=api", "name": "Rob Clark", "email": "robdclark@gmail.com" }, "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/20170912204005.30404-1-robdclark@gmail.com/mbox/", "series": [ { "id": 2771, "url": "http://patchwork.ozlabs.org/api/series/2771/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=2771", "date": "2017-09-12T20:40:01", "name": "[U-Boot] fs/fat: fix fatbuf leak", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/2771/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/813059/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/813059/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": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"fX+tI3mH\"; dkim-atps=neutral" ], "Received": [ "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xsGrg0NX6z9sNw\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 06:40:18 +1000 (AEST)", "by lists.denx.de (Postfix, from userid 105)\n\tid C1206C220C5; Tue, 12 Sep 2017 20:40:13 +0000 (UTC)", "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 6E17BC21D90;\n\tTue, 12 Sep 2017 20:40:11 +0000 (UTC)", "by lists.denx.de (Postfix, from userid 105)\n\tid 2FCB2C21DA2; Tue, 12 Sep 2017 20:40:10 +0000 (UTC)", "from mail-qt0-f196.google.com (mail-qt0-f196.google.com\n\t[209.85.216.196])\n\tby lists.denx.de (Postfix) with ESMTPS id 8D2EDC21D90\n\tfor <u-boot@lists.denx.de>; Tue, 12 Sep 2017 20:40:09 +0000 (UTC)", "by mail-qt0-f196.google.com with SMTP id l25so5120984qtf.2\n\tfor <u-boot@lists.denx.de>; Tue, 12 Sep 2017 13:40:09 -0700 (PDT)", "from localhost ([144.121.20.162]) by smtp.gmail.com with ESMTPSA id\n\tn87sm8956251qkh.18.2017.09.12.13.40.06\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tTue, 12 Sep 2017 13:40:07 -0700 (PDT)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=-0.0 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID\n\tautolearn=unavailable autolearn_force=no version=3.4.0", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id;\n\tbh=ulH8b2z0qQ4ORySzgb31sSEpR+oUjsP2oEge2XZY/F8=;\n\tb=fX+tI3mHWgMbfwj1zba0HZpNZbMHOmNAbOGocQ5Yi9lY+IGNcAalNbmz/+It5yzTqU\n\tDO3UGg/hFtfk6aLHIRFTyrf5fiXyl/ozZ/aeS7w0O7R1jxWArnDIRhw6yF4KLCsOosH4\n\tlKkeJW7+1rQJ7HJx8TViiOP/jyXsCZxvLWaL4Y2Mkff0VWC501SJK74Jladsk3iVYlVF\n\tiAbs0UcebF5eyF/fwAmOA3AWX5RHymfkALFAICA6Ty5Zs2vd55Mo6/UjHNViPFJfS88W\n\tffbY7k0Z9BKNans+coaQ/4oq/6mZWgsk+ArJcLNfPJSmQDiw5pxS9Sk7htRT8NxUBwjw\n\tarzg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=ulH8b2z0qQ4ORySzgb31sSEpR+oUjsP2oEge2XZY/F8=;\n\tb=je3qE+Z8r5DZa6DEUqjepNe43R0jLX5lBvozw3VGS4z6k7fsmt01ayPfJ+a34GIIp9\n\tu4qEB2c/ZK8EeUgEMlMvzK8tYiewqPYvoyzrsoINTEwaJGFRmSlC2rrNFgDIGGHKjb91\n\twcYRLt4cyDw/QcvD5fMoqxg7wE8bSmSVnBrEG3DIMEMDOzYryRHnuMVqa3C0A0F0SL/y\n\trK2VI9UMHySlHYDZdspjrIV9EFVlRkOLt9It/RLLLnOWAaeF1VTHaycBSGJxLFcohMsy\n\tTiQXIr+WOOLFsO1hc5Wl+/oxMFt1rDZGB9OHnuPP5OkvLXMXgJQ1LV3v/H5cCmAg204o\n\twqIQ==", "X-Gm-Message-State": "AHPjjUgL1GpAppHIScA+GImW5dl46z01M/qM+rZBCOwtaCjSPaYbNCqC\n\tZ84Xxi6Wmv9NhhzuzmE=", "X-Google-Smtp-Source": "AOwi7QAVjdBrgqxW3IC5hRapj5KxjVrmnMsE59GUGZzjjOIC1STrVTaR+wNUjIEWY7XQGu3JdztuqA==", "X-Received": "by 10.237.55.228 with SMTP id j91mr24276166qtb.28.1505248808072; \n\tTue, 12 Sep 2017 13:40:08 -0700 (PDT)", "From": "Rob Clark <robdclark@gmail.com>", "To": "U-Boot Mailing List <u-boot@lists.denx.de>", "Date": "Tue, 12 Sep 2017 16:40:01 -0400", "Message-Id": "<20170912204005.30404-1-robdclark@gmail.com>", "X-Mailer": "git-send-email 2.13.5", "Subject": "[U-Boot] [PATCH] fs/fat: fix fatbuf leak", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.18", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<http://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\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>" }, "content": "A new fatbuf was allocated by get_fs_info() (called by fat_itr_root()),\nbut not freed, resulting in eventually running out of memory. Spotted\nby running 'ls -r' in a large FAT filesystem from Shell.efi.\n\nfatbuf is mainly used to cache FAT entry lookups (get_fatent())..\npossibly once fat_write.c it can move into the iterator to simplify\nthis.\n\nSigned-off-by: Rob Clark <robdclark@gmail.com>\n---\nI can squash this back in to the earlier readdir patches and resend\nthem if that is preferred.\n\n fs/fat/fat.c | 23 ++++++++++++++++-------\n 1 file changed, 16 insertions(+), 7 deletions(-)", "diff": "diff --git a/fs/fat/fat.c b/fs/fat/fat.c\nindex f5f74c12ff..f0284398b4 100644\n--- a/fs/fat/fat.c\n+++ b/fs/fat/fat.c\n@@ -1042,6 +1042,7 @@ int fat_exists(const char *filename)\n \t\treturn 0;\n \n \tret = fat_itr_resolve(itr, filename, TYPE_ANY);\n+\tfree(fsdata.fatbuf);\n \treturn ret == 0;\n }\n \n@@ -1061,17 +1062,19 @@ int fat_size(const char *filename, loff_t *size)\n \t\t * Directories don't have size, but fs_size() is not\n \t\t * expected to fail if passed a directory path:\n \t\t */\n+\t\tfree(fsdata.fatbuf);\n \t\tfat_itr_root(itr, &fsdata);\n \t\tif (!fat_itr_resolve(itr, filename, TYPE_DIR)) {\n \t\t\t*size = 0;\n-\t\t\treturn 0;\n+\t\t\tret = 0;\n \t\t}\n-\t\treturn ret;\n+\t\tgoto out;\n \t}\n \n \t*size = FAT2CPU32(itr->dent->size);\n-\n-\treturn 0;\n+out:\n+\tfree(fsdata.fatbuf);\n+\treturn ret;\n }\n \n int file_fat_read_at(const char *filename, loff_t pos, void *buffer,\n@@ -1087,10 +1090,14 @@ int file_fat_read_at(const char *filename, loff_t pos, void *buffer,\n \n \tret = fat_itr_resolve(itr, filename, TYPE_FILE);\n \tif (ret)\n-\t\treturn ret;\n+\t\tgoto out;\n \n \tprintf(\"reading %s\\n\", filename);\n-\treturn get_contents(&fsdata, itr->dent, pos, buffer, maxsize, actread);\n+\tret = get_contents(&fsdata, itr->dent, pos, buffer, maxsize, actread);\n+\n+out:\n+\tfree(fsdata.fatbuf);\n+\treturn ret;\n }\n \n int file_fat_read(const char *filename, void *buffer, int maxsize)\n@@ -1126,7 +1133,7 @@ typedef struct {\n \n int fat_opendir(const char *filename, struct fs_dir_stream **dirsp)\n {\n-\tfat_dir *dir = malloc(sizeof(*dir));\n+\tfat_dir *dir = calloc(1, sizeof(*dir));\n \tint ret;\n \n \tif (!dir)\n@@ -1144,6 +1151,7 @@ int fat_opendir(const char *filename, struct fs_dir_stream **dirsp)\n \treturn 0;\n \n fail:\n+\tfree(dir->fsdata.fatbuf);\n \tfree(dir);\n \treturn ret;\n }\n@@ -1174,6 +1182,7 @@ int fat_readdir(struct fs_dir_stream *dirs, struct fs_dirent **dentp)\n void fat_closedir(struct fs_dir_stream *dirs)\n {\n \tfat_dir *dir = (fat_dir *)dirs;\n+\tfree(dir->fsdata.fatbuf);\n \tfree(dir);\n }\n \n", "prefixes": [ "U-Boot" ] }