Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drivers/isdn/i4l/isdn_common.c fix small resource leak

Coverity CID: 1356 RESOURCE_LEAK

I found a very old patch for this that was Acked but did not get applied
https://lists.linux-foundation.org/pipermail/kernel-janitors/2006-September/016362.html

There looks to be a small leak in isdn_writebuf_stub() in isdn_common.c, when
copy_from_user() returns an un-copied data length (length != 0). The below
patch should be a minimally invasive fix.

Signed-off-by: Darren Jenkins <darrenrjenkins@gmailcom>
Acked-by: Karsten Keil <kkeil@suse.de>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Darren Jenkins and committed by
Linus Torvalds
4fc89e39 43f77e91

+3 -1
+3 -1
drivers/isdn/i4l/isdn_common.c
··· 1977 1977 if (!skb) 1978 1978 return -ENOMEM; 1979 1979 skb_reserve(skb, hl); 1980 - if (copy_from_user(skb_put(skb, len), buf, len)) 1980 + if (copy_from_user(skb_put(skb, len), buf, len)) { 1981 + dev_kfree_skb(skb); 1981 1982 return -EFAULT; 1983 + } 1982 1984 ret = dev->drv[drvidx]->interface->writebuf_skb(drvidx, chan, 1, skb); 1983 1985 if (ret <= 0) 1984 1986 dev_kfree_skb(skb);