patch-2.2.18 linux/net/x25/x25_out.c
Next file: linux/scripts/Lindent
Previous file: linux/net/x25/x25_dev.c
Back to the patch index
Back to the overall index
- Lines: 41
- Date:
Tue Sep 26 21:50:14 2000
- Orig file:
v2.2.17/net/x25/x25_out.c
- Orig date:
Fri Apr 21 12:47:17 2000
diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/net/x25/x25_out.c linux/net/x25/x25_out.c
@@ -15,6 +15,7 @@
* History
* X.25 001 Jonathan Naylor Started coding.
* X.25 002 Jonathan Naylor New timer architecture.
+ * 2000-09-04 Henner Eisen Prevented x25_output() skb leakage.
*/
#include <linux/config.h>
@@ -56,7 +57,7 @@
/*
* This is where all X.25 information frames pass;
*/
-void x25_output(struct sock *sk, struct sk_buff *skb)
+int x25_output(struct sock *sk, struct sk_buff *skb)
{
struct sk_buff *skbn;
unsigned char header[X25_EXT_MIN_LEN];
@@ -73,9 +74,12 @@
frontlen = skb_headroom(skb);
while (skb->len > 0) {
- if ((skbn = sock_alloc_send_skb(sk, frontlen + max_len, 0, 0, &err)) == NULL)
- return;
-
+ if ((skbn = sock_alloc_send_skb(sk, frontlen + max_len, 0, 0, &err)) == NULL){
+ int unsent = skb->len - header_len;
+ SOCK_DEBUG(sk, "x25_output: fragment allocation failed, err=%d, %d bytes unsent\n", err, unsent);
+ return err;
+ }
+
skb_reserve(skbn, frontlen);
len = (max_len > skb->len) ? skb->len : max_len;
@@ -102,6 +106,7 @@
} else {
skb_queue_tail(&sk->write_queue, skb);
}
+ return 0;
}
/*
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)