diff options
author | Zhipeng Lu <alexious@zju.edu.cn> | 2024-01-17 09:14:19 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2024-02-01 13:49:18 +0100 |
commit | dc9ceb90c4b42c6e5c6757df1d6257110433788e (patch) | |
tree | 660b2d2c2c64df2cc7c561a256325cd8d6b4de0c /drivers/media/rc | |
parent | media: rc: bpf attach/detach requires write permission (diff) | |
download | linux-dc9ceb90c4b42c6e5c6757df1d6257110433788e.tar.xz linux-dc9ceb90c4b42c6e5c6757df1d6257110433788e.zip |
media: ir_toy: fix a memleak in irtoy_tx
When irtoy_command fails, buf should be freed since it is allocated by
irtoy_tx, or there is a memleak.
Fixes: 4114978dcd24 ("media: ir_toy: prevent device from hanging during transmit")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/rc')
-rw-r--r-- | drivers/media/rc/ir_toy.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/media/rc/ir_toy.c b/drivers/media/rc/ir_toy.c index 196806709259..69e630d85262 100644 --- a/drivers/media/rc/ir_toy.c +++ b/drivers/media/rc/ir_toy.c @@ -332,6 +332,7 @@ static int irtoy_tx(struct rc_dev *rc, uint *txbuf, uint count) sizeof(COMMAND_SMODE_EXIT), STATE_COMMAND_NO_RESP); if (err) { dev_err(irtoy->dev, "exit sample mode: %d\n", err); + kfree(buf); return err; } @@ -339,6 +340,7 @@ static int irtoy_tx(struct rc_dev *rc, uint *txbuf, uint count) sizeof(COMMAND_SMODE_ENTER), STATE_COMMAND); if (err) { dev_err(irtoy->dev, "enter sample mode: %d\n", err); + kfree(buf); return err; } |