Message ID | 20240201124108.3052635-1-alexious@zju.edu.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-48145-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp119893dyb; Thu, 1 Feb 2024 04:42:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IGaLbJJfgcxlMC0hmjHNG372yxJb8nsNa9FHyxYuEEYxLX24JzHe0+25P04/Qm+0Oumyzlg X-Received: by 2002:a05:6402:1745:b0:55e:ef0b:e0a9 with SMTP id v5-20020a056402174500b0055eef0be0a9mr3273128edx.36.1706791341219; Thu, 01 Feb 2024 04:42:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706791341; cv=pass; d=google.com; s=arc-20160816; b=sYO0d2132HrRgNjFXFksO+BrmkZ450zKz1T+sp7t9V6FDwOdXf0UciHhUu6EHoRFQI iZcnt/jHU/8WmIC1J+J88DzHtFFI2qCs+6DkPz3jheJro0gxQAGjJ622vUBW1rUCy0oR EyezI7J74MHaqG3FSpygaMFcMzDnYGbFesjVxqajjtTwgjlSjEtyCxepCYrR+SutX2kW AHDkfF84uKifzk4BLJpxaSqdVzBHcVgo0ujeN98wmbHDeqSRZaMh1z5PyRR6SWFQP12i hofD89cil6Y10Rf1/l0urpiNDKNWVJPl6bXt2nBHAL05YkxNaYNd/MNtJF9aIZ488aG1 Ii9w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=EwWe1PDNjRDdysy2I8AwFEdr6YID1H3mvPQWVZ0ecjg=; fh=S2Z9cZ6btOVQOzBf0SCWwsmog7gzfj+VO9+8v+idxTk=; b=aegIFVHkUSwfoBjcGAzyG7m46xwryHxUnnJ78re57084VSYY7cIekk6x1t1/HRup3A oDPp/dtLzQ7AoLxUUvTTFk2A75q2umLWBRhXZrPMf4aDsAtDsw8lA07Jrg2xknIrJBKz Al5YqrZPEp3DX8D0scWNJG4MiaBFpVyunMZnftN7FpZRi6qp5CTkngQ0493RHP1tcjxz xpaEWiS3Vc46WmbibaBCjLwy9BK7iz83x8cFGSdQVBsAvVhIJ8RTjyM3bzZK0QIhf386 LdHa5cFM38ImCCAimq69jzdqIKwO91gMdtZ0rfyeaFM6zqCXwwar3cF65YSkvfqdYent cxCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=zju.edu.cn); spf=pass (google.com: domain of linux-kernel+bounces-48145-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48145-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCUGatmg29oBztcb8B0LxnHXjBHVitPbfSpFPu3AoNlMbnuV4jDFgUUNfH0LbWAv4Se3fY3c9RDg2MQoFrmMETERyLi/Bw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bt22-20020a0564020a5600b0055f04e114bfsi3975062edb.275.2024.02.01.04.42.21 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 04:42:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48145-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=zju.edu.cn); spf=pass (google.com: domain of linux-kernel+bounces-48145-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48145-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CD9BC1F260FB for <ouuuleilei@gmail.com>; Thu, 1 Feb 2024 12:42:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ECB715336E; Thu, 1 Feb 2024 12:41:48 +0000 (UTC) Received: from azure-sdnproxy.icoremail.net (azure-sdnproxy.icoremail.net [207.46.229.174]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A0D553363; Thu, 1 Feb 2024 12:41:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=207.46.229.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706791307; cv=none; b=OimGppKyitb+8jREfuab8FoUg05km8xOYiqb74oj3D+vU5SABfWFuKSK53dqEkv+EjQIQJqrmWPXFc900JbHnSck7iBUGBcGtDbL7KPr3Juuf5AUm++vtuRtfhvksdZ/jRIjMcyVKCgewn3VTxVZtvRkr0KWyPV8Xoh/PsA8qGg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706791307; c=relaxed/simple; bh=mTEwM8qtZQmg8mw1XWHtWN1F324EEuX/vctn70rwP6M=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=pLG6g+3sLp7GHt3WaQTbyOVtY2ZUl/BEi3boLlFgYedB+xhoy3xcbjlz8ChyfG6j9U49TOIN4vJ9YyHj0BoNywh4vu+uy59SmH5ttmwX24XRwdKCi1URHSiSDVQk8ApJxOg+T8/2ye1+YKiv4kI2ESiy/M9lpKq3A0RE8ARQ3Rw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zju.edu.cn; spf=pass smtp.mailfrom=zju.edu.cn; arc=none smtp.client-ip=207.46.229.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zju.edu.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zju.edu.cn Received: from luzhipeng.223.5.5.5 (unknown [220.184.253.207]) by mail-app3 (Coremail) with SMTP id cC_KCgAnDDZxkbtl8ZnjAA--.10172S2; Thu, 01 Feb 2024 20:41:21 +0800 (CST) From: Zhipeng Lu <alexious@zju.edu.cn> To: alexious@zju.edu.cn Cc: Chas Williams <3chas3@gmail.com>, linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] atm: idt77252: fix a memleak in open_card_ubr0 Date: Thu, 1 Feb 2024 20:41:05 +0800 Message-Id: <20240201124108.3052635-1-alexious@zju.edu.cn> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: cC_KCgAnDDZxkbtl8ZnjAA--.10172S2 X-Coremail-Antispam: 1UD129KBjvdXoW7GrykKr4rAw4xJr17GrW7Arb_yoWfXFXE9a 4Fqw12q3yYqwn2ya15GFyfuayj9a10yw1ku342qanxGrZFkFW3XrWkW3WaqF13WayxZFZ8 Kryjg34DZr18GjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbsxFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j 6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCY1x0262kKe7AKxVWU AVWUtwCY02Avz4vE14v_Xr1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr 1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE 14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7 IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E 87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0x ZFpf9x0JUc189UUUUU= X-CM-SenderInfo: qrsrjiarszq6lmxovvfxof0/ X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789700437312980813 X-GMAIL-MSGID: 1789700437312980813 |
Series |
atm: idt77252: fix a memleak in open_card_ubr0
|
|
Commit Message
Zhipeng Lu
Feb. 1, 2024, 12:41 p.m. UTC
When alloc_scq fails, card->vcs[0] (i.e. vc) should be freed. Otherwise,
in the following call chain:
idt77252_init_one
|-> idt77252_dev_open
|-> open_card_ubr0
|-> alloc_scq [failed]
|-> deinit_card
|-> vfree(card->vcs);
card->vcs is freed and card->vcs[0] is leaked.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
---
drivers/atm/idt77252.c | 2 ++
1 file changed, 2 insertions(+)
Comments
Thu, Feb 01, 2024 at 01:41:05PM CET, alexious@zju.edu.cn wrote: >When alloc_scq fails, card->vcs[0] (i.e. vc) should be freed. Otherwise, >in the following call chain: > >idt77252_init_one > |-> idt77252_dev_open > |-> open_card_ubr0 > |-> alloc_scq [failed] > |-> deinit_card > |-> vfree(card->vcs); > >card->vcs is freed and card->vcs[0] is leaked. > >Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") >Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Hello: This patch was applied to netdev/net.git (main) by David S. Miller <davem@davemloft.net>: On Thu, 1 Feb 2024 20:41:05 +0800 you wrote: > When alloc_scq fails, card->vcs[0] (i.e. vc) should be freed. Otherwise, > in the following call chain: > > idt77252_init_one > |-> idt77252_dev_open > |-> open_card_ubr0 > |-> alloc_scq [failed] > |-> deinit_card > |-> vfree(card->vcs); > > [...] Here is the summary with links: - atm: idt77252: fix a memleak in open_card_ubr0 https://git.kernel.org/netdev/net/c/f3616173bf9b You are awesome, thank you!
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c index e327a0229dc1..e7f713cd70d3 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c @@ -2930,6 +2930,8 @@ open_card_ubr0(struct idt77252_dev *card) vc->scq = alloc_scq(card, vc->class); if (!vc->scq) { printk("%s: can't get SCQ.\n", card->name); + kfree(card->vcs[0]); + card->vcs[0] = NULL; return -ENOMEM; }