summaryrefslogtreecommitdiffstats
path: root/drivers/atm
diff options
context:
space:
mode:
authorZhipeng Lu <alexious@zju.edu.cn>2024-02-01 13:41:05 +0100
committerDavid S. Miller <davem@davemloft.net>2024-02-03 13:46:13 +0100
commitf3616173bf9be9bf39d131b120d6eea4e6324cb5 (patch)
tree37408c4a47185014f42996f288bbfec596b09fc1 /drivers/atm
parenttunnels: fix out of bounds access when building IPv6 PMTU error (diff)
downloadlinux-f3616173bf9be9bf39d131b120d6eea4e6324cb5.tar.xz
linux-f3616173bf9be9bf39d131b120d6eea4e6324cb5.zip
atm: idt77252: fix a memleak in open_card_ubr0
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/atm')
-rw-r--r--drivers/atm/idt77252.c2
1 files changed, 2 insertions, 0 deletions
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;
}