Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1376541/?format=api
{ "id": 1376541, "url": "http://patchwork.ozlabs.org/api/patches/1376541/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20201004205536.4734-1-anant.thazhemadam@gmail.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20201004205536.4734-1-anant.thazhemadam@gmail.com>", "list_archive_url": null, "date": "2020-10-04T20:55:36", "name": "net: team: fix memory leak in __team_options_register", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "16932cfd04e15b65ec45be25f8fb7392a682029d", "submitter": { "id": 80040, "url": "http://patchwork.ozlabs.org/api/people/80040/?format=api", "name": "Anant Thazhemadam", "email": "anant.thazhemadam@gmail.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20201004205536.4734-1-anant.thazhemadam@gmail.com/mbox/", "series": [ { "id": 205910, "url": "http://patchwork.ozlabs.org/api/series/205910/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=205910", "date": "2020-10-04T20:55:36", "name": "net: team: fix memory leak in __team_options_register", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/205910/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1376541/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1376541/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming-netdev@ozlabs.org", "Delivered-To": "patchwork-incoming-netdev@ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=23.128.96.18; helo=vger.kernel.org;\n envelope-from=netdev-owner@vger.kernel.org; receiver=<UNKNOWN>)", "ozlabs.org;\n dmarc=fail (p=none dis=none) header.from=gmail.com", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20161025 header.b=RXs+HjiF;\n\tdkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [23.128.96.18])\n\tby ozlabs.org (Postfix) with ESMTP id 4C4GGx4bvbz9sS8\n\tfor <patchwork-incoming-netdev@ozlabs.org>;\n Mon, 5 Oct 2020 07:56:09 +1100 (AEDT)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n id S1726572AbgJDU4A (ORCPT\n <rfc822;patchwork-incoming-netdev@ozlabs.org>);\n Sun, 4 Oct 2020 16:56:00 -0400", "from lindbergh.monkeyblade.net ([23.128.96.19]:46636 \"EHLO\n lindbergh.monkeyblade.net\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n with ESMTP id S1726345AbgJDUz7 (ORCPT\n <rfc822;netdev@vger.kernel.org>); Sun, 4 Oct 2020 16:55:59 -0400", "from mail-pg1-x543.google.com (mail-pg1-x543.google.com\n [IPv6:2607:f8b0:4864:20::543])\n by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80E36C0613CE;\n Sun, 4 Oct 2020 13:55:59 -0700 (PDT)", "by mail-pg1-x543.google.com with SMTP id h6so3778096pgk.4;\n Sun, 04 Oct 2020 13:55:59 -0700 (PDT)", "from localhost.localdomain ([49.207.217.69])\n by smtp.gmail.com with ESMTPSA id\n c3sm9772626pfn.23.2020.10.04.13.55.54\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sun, 04 Oct 2020 13:55:57 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20161025;\n h=from:to:cc:subject:date:message-id:mime-version\n :content-transfer-encoding;\n bh=pdvIIyxIuMTWPTkysqTwPpBrn7TuPnPJbCEXdGhmjXA=;\n b=RXs+HjiFGShmJ1wccK4uLdFWOSKbcxMcxA8COMUvEfPHgcT97pzYi9/nO6rI1bFdIL\n hsNx3tyJbH2aofisNie/6oQSUoozVNJLaYAu6KlF7NSsjrKxUXQugtL64Ee3NOKCcGmp\n qfKroWi2W7fOgKSY6fpZlOQqccdC0kHZjW88fyhr4BULhpWTkg3etdlysXu0YW9bKl2b\n 7j5Uy+FRiDQDfm9wOqF0X6O1FvVwNi7iOy2LVIBx/96MoVMYg0Nj71fy77t+L76eoX4h\n w+WU/yLoDq42JxwSKV+TJf9a8wtslAeXCns/ZHDf2h+XXL3EnBo266soKVAa5JJCYxcK\n KAaw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n :content-transfer-encoding;\n bh=pdvIIyxIuMTWPTkysqTwPpBrn7TuPnPJbCEXdGhmjXA=;\n b=Fn3vjvKA6bvkyYbtu1Zzznn3FovEMFi8S7EtZgn0m84Jf6dlV0CYbVieG3BI6JxAcz\n OerQjgOO15tthuc2CM+NgsdFGwWVHy4PqQj4aukgPMkwrNXejYnX0v/LyKu3YnBor5Q1\n W/RUECjBb+CTJLEk4D69szCaQTeL/UlMwVh6BsHVbORVQb8t065xl67NvaQG5aFX0eNx\n 4IWaPg+FLfgvuBtV8E1DdNoQZP5CnszJpODqbVOuiK+T08xeckYLQKCR8wbgF6d7LvaV\n CSv4eb4YxfCfhEL47uA1Pm062nBb76lfIRIkukQnax9gzApIT49zqZWeTNHCK6n2M9Hh\n QTaw==", "X-Gm-Message-State": "AOAM5333wLSiovnMmRl1le83pH4E096mOx1D3KxKgTjqvHcSkVC4C1+v\n lI8uqD7kJEs3nezz2aHhmHw=", "X-Google-Smtp-Source": "\n ABdhPJwkVdTzeLRWaTwuE8jAGC/0IdkS4W0EMUIfqLH2ZZNDgkobsQUe+R2RbfrfafluMXAuq2ly8g==", "X-Received": "by 2002:a62:1844:0:b029:152:80d3:8647 with SMTP id\n 65-20020a6218440000b029015280d38647mr1751507pfy.18.1601844958883;\n Sun, 04 Oct 2020 13:55:58 -0700 (PDT)", "From": "Anant Thazhemadam <anant.thazhemadam@gmail.com>", "Cc": "linux-kernel-mentees@lists.linuxfoundation.org,\n Anant Thazhemadam <anant.thazhemadam@gmail.com>,\n syzbot+69b804437cfec30deac3@syzkaller.appspotmail.com,\n Jiri Pirko <jiri@resnulli.us>,\n \"David S. Miller\" <davem@davemloft.net>,\n Jakub Kicinski <kuba@kernel.org>, netdev@vger.kernel.org,\n linux-kernel@vger.kernel.org", "Subject": "[PATCH] net: team: fix memory leak in __team_options_register", "Date": "Mon, 5 Oct 2020 02:25:36 +0530", "Message-Id": "<20201004205536.4734-1-anant.thazhemadam@gmail.com>", "X-Mailer": "git-send-email 2.25.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "To": "unlisted-recipients:; (no To-header on input)", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "The variable \"i\" isn't initialized back correctly after the first loop\nunder the label inst_rollback gets executed.\n\nThe value of \"i\" is assigned to be option_count - 1, and the ensuing \nloop (under alloc_rollback) begins by initializing i--. \nThus, the value of i when the loop begins execution will now become \ni = option_count - 2.\n\nThus, when kfree(dst_opts[i]) is called in the second loop in this \norder, (i.e., inst_rollback followed by alloc_rollback), \ndst_optsp[option_count - 2] is the first element freed, and \ndst_opts[option_count - 1] does not get freed, and thus, a memory \nleak is caused.\n\nThis memory leak can be fixed, by assigning i = option_count (instead of\noption_count - 1).\n\nFixes: 80f7c6683fe0 (\"team: add support for per-port options\")\nReported-by: syzbot+69b804437cfec30deac3@syzkaller.appspotmail.com\nTested-by: syzbot+69b804437cfec30deac3@syzkaller.appspotmail.com\nSigned-off-by: Anant Thazhemadam <anant.thazhemadam@gmail.com>\n---\n drivers/net/team/team.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)", "diff": "diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c\nindex 8c1e02752ff6..8986f3ffffe4 100644\n--- a/drivers/net/team/team.c\n+++ b/drivers/net/team/team.c\n@@ -287,7 +287,7 @@ static int __team_options_register(struct team *team,\n \tfor (i--; i >= 0; i--)\n \t\t__team_option_inst_del_option(team, dst_opts[i]);\n \n-\ti = option_count - 1;\n+\ti = option_count;\n alloc_rollback:\n \tfor (i--; i >= 0; i--)\n \t\tkfree(dst_opts[i]);\n", "prefixes": [] }