Re: [SCTP]: Fix up sctp_rcv return value

2006-03-25 Thread David S. Miller
From: Herbert Xu [EMAIL PROTECTED]
Date: Sat, 25 Mar 2006 16:42:56 +1100

 I was working on the ipip/xfrm problem and as usual I get side-tracked by
 other problems.

It is the nature of the game :-)

 As part of an attempt to change the IPv4 protocol handler calling
 convention I found that SCTP violated the existing convention.
 
 It's returning non-zero values after freeing the skb.  This is doubly bad
 as 1) the skb gets resubmitted; 2) the return value is interpreted as a
 protocol number.
 
 This patch changes those return values to zero.
 
 IPv6 doesn't suffer from this problem because it uses a positive return
 value as an indication for resubmission.  So the only effect of this patch
 there is to increment the IPSTATS_MIB_INDELIVERS counter which IMHO is
 the right thing to do.
 
 Signed-off-by: Herbert Xu [EMAIL PROTECTED]

Good catch, applied.

Thanks Herbert.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCTP]: Fix up sctp_rcv return value

2006-03-24 Thread Herbert Xu
Hi Dave:

I was working on the ipip/xfrm problem and as usual I get side-tracked by
other problems.

As part of an attempt to change the IPv4 protocol handler calling
convention I found that SCTP violated the existing convention.

It's returning non-zero values after freeing the skb.  This is doubly bad
as 1) the skb gets resubmitted; 2) the return value is interpreted as a
protocol number.

This patch changes those return values to zero.

IPv6 doesn't suffer from this problem because it uses a positive return
value as an indication for resubmission.  So the only effect of this patch
there is to increment the IPSTATS_MIB_INDELIVERS counter which IMHO is
the right thing to do.

Signed-off-by: Herbert Xu [EMAIL PROTECTED]

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
diff --git a/net/sctp/input.c b/net/sctp/input.c
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -127,7 +127,6 @@ int sctp_rcv(struct sk_buff *skb)
union sctp_addr dest;
int family;
struct sctp_af *af;
-   int ret = 0;
 
if (skb-pkt_type!=PACKET_HOST)
goto discard_it;
@@ -227,16 +226,13 @@ int sctp_rcv(struct sk_buff *skb)
goto discard_release;
nf_reset(skb);
 
-   ret = sk_filter(sk, skb, 1);
-   if (ret)
+   if (sk_filter(sk, skb, 1))
 goto discard_release;
 
/* Create an SCTP packet structure. */
chunk = sctp_chunkify(skb, asoc, sk);
-   if (!chunk) {
-   ret = -ENOMEM;
+   if (!chunk)
goto discard_release;
-   }
SCTP_INPUT_CB(skb)-chunk = chunk;
 
/* Remember what endpoint is to handle this packet. */
@@ -277,11 +273,11 @@ int sctp_rcv(struct sk_buff *skb)
sctp_bh_unlock_sock(sk);
sock_put(sk);
 
-   return ret;
+   return 0;
 
 discard_it:
kfree_skb(skb);
-   return ret;
+   return 0;
 
 discard_release:
/* Release any structures we may be holding. */