diff options
author | Zhipeng Lu <alexious@zju.edu.cn> | 2024-02-01 20:41:05 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-02-23 08:12:53 +0100 |
commit | bd70b7541b30213829ca7a2d02e428a4449821ff (patch) | |
tree | 818b177320dfe0ffeff490f3a9a8d02bc9525f20 | |
parent | 486218c11e8d1c8f515a3bdd70d62203609d4b6b (diff) | |
download | linux-stable-bd70b7541b30213829ca7a2d02e428a4449821ff.tar.gz linux-stable-bd70b7541b30213829ca7a2d02e428a4449821ff.tar.bz2 linux-stable-bd70b7541b30213829ca7a2d02e428a4449821ff.zip |
atm: idt77252: fix a memleak in open_card_ubr0
[ Upstream commit f3616173bf9be9bf39d131b120d6eea4e6324cb5 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/atm/idt77252.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c index 3380322df98e..36629633ae52 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c @@ -2936,6 +2936,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; } |