In the Linux kernel, the following vulnerability has been resolved:
atm: Revert atmaccounttx() if copyfromiter_full() fails.
In vccsendmsg(), we account skb->truesize to sk->skwmemalloc by atmaccount_tx().
It is expected to be reverted by atmpopraw() later called by vcc->dev->ops->send(vcc, skb).
However, vccsendmsg() misses the same revert when copyfromiterfull() fails, and then we will leak a socket.
Let's factorise the revert part as atmreturntx() and call it in the failure path.
Note that the corresponding skwmemalloc operation can be found in alloc_tx() as of the blamed commit.
$ git blame -L:alloc_tx net/atm/common.c c55fa3cccbc2c~