aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarsten Keil <keil@b1-systems.de>2009-05-22 11:04:52 +0000
committerDavid S. Miller <davem@davemloft.net>2009-05-25 00:55:30 -0700
commit5df3b8bcc7826b85a2d233dd20da3ed247e1dc1d (patch)
treea1a3a9a9e9b304088c6d0e6b07ea03136c40536d
parentd796509a57777bc0f8f336e360695fad665c59f5 (diff)
mISDN: Fix skb leak in error cases
If the channel receive function returns an error the skb must be freed. Signed-off-by: Karsten Keil <keil@b1-systems.de> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/isdn/mISDN/socket.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c
index 530f6897736..2a2c30a9438 100644
--- a/drivers/isdn/mISDN/socket.c
+++ b/drivers/isdn/mISDN/socket.c
@@ -209,7 +209,7 @@ mISDN_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {
err = -EFAULT;
- goto drop;
+ goto done;
}
memcpy(mISDN_HEAD_P(skb), skb->data, MISDN_HEADER_LEN);
@@ -230,19 +230,21 @@ mISDN_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
__func__, mISDN_HEAD_ID(skb));
err = -ENODEV;
- if (!_pms(sk)->ch.peer ||
- (err = _pms(sk)->ch.recv(_pms(sk)->ch.peer, skb)))
- goto drop;
-
- err = len;
+ if (!_pms(sk)->ch.peer)
+ goto done;
+ err = _pms(sk)->ch.recv(_pms(sk)->ch.peer, skb);
+ if (err)
+ goto done;
+ else {
+ skb = NULL;
+ err = len;
+ }
done:
+ if (skb)
+ kfree_skb(skb);
release_sock(sk);
return err;
-
-drop:
- kfree_skb(skb);
- goto done;
}
static int