Commit 5df3b8bc authored by Karsten Keil's avatar Karsten Keil Committed by David S. Miller

mISDN: Fix skb leak in error cases

If the channel receive function returns an error the skb must be freed.
Signed-off-by: default avatarKarsten Keil <keil@b1-systems.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d796509a
...@@ -209,7 +209,7 @@ mISDN_sock_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -209,7 +209,7 @@ mISDN_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) { if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {
err = -EFAULT; err = -EFAULT;
goto drop; goto done;
} }
memcpy(mISDN_HEAD_P(skb), skb->data, MISDN_HEADER_LEN); memcpy(mISDN_HEAD_P(skb), skb->data, MISDN_HEADER_LEN);
...@@ -230,19 +230,21 @@ mISDN_sock_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -230,19 +230,21 @@ mISDN_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
__func__, mISDN_HEAD_ID(skb)); __func__, mISDN_HEAD_ID(skb));
err = -ENODEV; err = -ENODEV;
if (!_pms(sk)->ch.peer || if (!_pms(sk)->ch.peer)
(err = _pms(sk)->ch.recv(_pms(sk)->ch.peer, skb))) goto done;
goto drop; err = _pms(sk)->ch.recv(_pms(sk)->ch.peer, skb);
if (err)
goto done;
else {
skb = NULL;
err = len; err = len;
}
done: done:
if (skb)
kfree_skb(skb);
release_sock(sk); release_sock(sk);
return err; return err;
drop:
kfree_skb(skb);
goto done;
} }
static int static int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment