All of lore.kernel.org
 help / color / mirror / Atom feed
* Use correct NET_RX_* returns for atalk_rcv()
@ 2009-08-07  9:21 Mark Smith
  2009-08-07 10:34 ` Forgot "[PATCH]" - " Mark Smith
  2009-08-13  5:15 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Smith @ 2009-08-07  9:21 UTC (permalink / raw)
  To: acme; +Cc: netdev


    In all rx'd SKB cases, atalk_rcv() either eventually jumps to or falls through
    to the label out:, which  returns numeric 0. Numeric 0 corresponds to
    NET_RX_SUCCESS, which is incorrect in failed SKB cases.
    
    This patch makes atalk_rcv() provide the correct returns by:
    
    o  explicitly returning NET_RX_SUCCESS in the two success cases
    o  having the out: label return NET_RX_DROP, instead of numeric 0
    o  making the failed SKB labels and processing more consistent with other
       _rcv() routines in the kernel, simplifying validation and removing a
       backwards goto

Signed-off-by: Mark Smith <markzzzsmith@yahoo.com.au>

diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 590b839..2377ebe 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -1398,7 +1398,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
 	__u16 len_hops;
 
 	if (!net_eq(dev_net(dev), &init_net))
-		goto freeit;
+		goto drop;
 
 	/* Don't mangle buffer if shared */
 	if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
@@ -1406,7 +1406,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
 
 	/* Size check and make sure header is contiguous */
 	if (!pskb_may_pull(skb, sizeof(*ddp)))
-		goto freeit;
+		goto drop;
 
 	ddp = ddp_hdr(skb);
 
@@ -1424,7 +1424,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
 	if (skb->len < sizeof(*ddp) || skb->len < (len_hops & 1023)) {
 		pr_debug("AppleTalk: dropping corrupted frame (deh_len=%u, "
 			 "skb->len=%u)\n", len_hops & 1023, skb->len);
-		goto freeit;
+		goto drop;
 	}
 
 	/*
@@ -1434,7 +1434,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
 	if (ddp->deh_sum &&
 	    atalk_checksum(skb, len_hops & 1023) != ddp->deh_sum)
 		/* Not a valid AppleTalk frame - dustbin time */
-		goto freeit;
+		goto drop;
 
 	/* Check the packet is aimed at us */
 	if (!ddp->deh_dnet)	/* Net 0 is 'this network' */
@@ -1447,7 +1447,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
 		 * AppleTalk iface
 		 */
 		atalk_route_packet(skb, dev, ddp, len_hops, origlen);
-		goto out;
+		return NET_RX_SUCCESS;
 	}
 
 	/* if IP over DDP is not selected this code will be optimized out */
@@ -1463,18 +1463,21 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
 
 	sock = atalk_search_socket(&tosat, atif);
 	if (!sock) /* But not one of our sockets */
-		goto freeit;
+		goto drop;
 
 	/* Queue packet (standard) */
 	skb->sk = sock;
 
 	if (sock_queue_rcv_skb(sock, skb) < 0)
-		goto freeit;
-out:
-	return 0;
-freeit:
+		goto drop;
+
+	return NET_RX_SUCCESS;
+
+drop:
 	kfree_skb(skb);
-	goto out;
+out:
+	return NET_RX_DROP;
+
 }
 
 /*

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Forgot "[PATCH]" - Re: Use correct NET_RX_* returns for atalk_rcv()
  2009-08-07  9:21 Use correct NET_RX_* returns for atalk_rcv() Mark Smith
@ 2009-08-07 10:34 ` Mark Smith
  2009-08-13  5:15 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Smith @ 2009-08-07 10:34 UTC (permalink / raw)
  To: Mark Smith; +Cc: acme, netdev

On Fri, 7 Aug 2009 18:51:22 +0930
Mark Smith <lk-netdev@lk-netdev.nosense.org> wrote:

> 
>     In all rx'd SKB cases, atalk_rcv() either eventually jumps to or falls through
>     to the label out:, which  returns numeric 0. Numeric 0 corresponds to
>     NET_RX_SUCCESS, which is incorrect in failed SKB cases.

<snip>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Use correct NET_RX_* returns for atalk_rcv()
  2009-08-07  9:21 Use correct NET_RX_* returns for atalk_rcv() Mark Smith
  2009-08-07 10:34 ` Forgot "[PATCH]" - " Mark Smith
@ 2009-08-13  5:15 ` David Miller
  2009-08-13  9:30   ` Mark Smith
  1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2009-08-13  5:15 UTC (permalink / raw)
  To: lk-netdev; +Cc: acme, netdev

From: Mark Smith <lk-netdev@lk-netdev.nosense.org>
Date: Fri, 7 Aug 2009 18:51:22 +0930

> 
>     In all rx'd SKB cases, atalk_rcv() either eventually jumps to or falls through
>     to the label out:, which  returns numeric 0. Numeric 0 corresponds to
>     NET_RX_SUCCESS, which is incorrect in failed SKB cases.
>     
>     This patch makes atalk_rcv() provide the correct returns by:
>     
>     o  explicitly returning NET_RX_SUCCESS in the two success cases
>     o  having the out: label return NET_RX_DROP, instead of numeric 0
>     o  making the failed SKB labels and processing more consistent with other
>        _rcv() routines in the kernel, simplifying validation and removing a
>        backwards goto
> 
> Signed-off-by: Mark Smith <markzzzsmith@yahoo.com.au>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Use correct NET_RX_* returns for atalk_rcv()
  2009-08-13  5:15 ` David Miller
@ 2009-08-13  9:30   ` Mark Smith
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Smith @ 2009-08-13  9:30 UTC (permalink / raw)
  To: David Miller; +Cc: acme, netdev

On Wed, 12 Aug 2009 22:15:50 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:

> From: Mark Smith <lk-netdev@lk-netdev.nosense.org>
> Date: Fri, 7 Aug 2009 18:51:22 +0930
> 
> > 
> >     In all rx'd SKB cases, atalk_rcv() either eventually jumps to or falls through
> >     to the label out:, which  returns numeric 0. Numeric 0 corresponds to
> >     NET_RX_SUCCESS, which is incorrect in failed SKB cases.
> >     
> >     This patch makes atalk_rcv() provide the correct returns by:
> >     
> >     o  explicitly returning NET_RX_SUCCESS in the two success cases
> >     o  having the out: label return NET_RX_DROP, instead of numeric 0
> >     o  making the failed SKB labels and processing more consistent with other
> >        _rcv() routines in the kernel, simplifying validation and removing a
> >        backwards goto
> > 
> > Signed-off-by: Mark Smith <markzzzsmith@yahoo.com.au>
> 
> Applied.

Thanks David.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-08-13  9:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-07  9:21 Use correct NET_RX_* returns for atalk_rcv() Mark Smith
2009-08-07 10:34 ` Forgot "[PATCH]" - " Mark Smith
2009-08-13  5:15 ` David Miller
2009-08-13  9:30   ` Mark Smith

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.