]> err.no Git - linux-2.6/commit
[IRDA]: Fix rfcomm use-after-free
authorMarcel Holtmann <marcel@holtmann.org>
Thu, 26 Jul 2007 07:12:25 +0000 (00:12 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Tue, 31 Jul 2007 09:28:05 +0000 (02:28 -0700)
commit09c7d8293a2d1317d16ef4ddb9f6dd2553d0694e
treea459a511a60427dd75796be371b4d1b99214acec
parent566cfd8f0e049a0647f94714f913e2a975dc464f
[IRDA]: Fix rfcomm use-after-free

Adrian Bunk wrote:
> Commit 8de0a15483b357d0f0b821330ec84d1660cadc4e added the following
> use-after-free in net/bluetooth/rfcomm/tty.c:
>
> <--  snip  -->
>
> ...
> static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
> {
> ...
>         if (IS_ERR(dev->tty_dev)) {
>                 list_del(&dev->list);
>                 kfree(dev);
>                 return PTR_ERR(dev->tty_dev);
>         }
> ...
>
> <--  snip  -->
>
> Spotted by the Coverity checker.

really good catch. I fully overlooked that one. The attached patch
should fix it.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bluetooth/rfcomm/tty.c