Netdev List
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH 2/5] llc: use rcu_dereference on receive handler
Date: Tue, 23 May 2006 17:04:16 -0700	[thread overview]
Message-ID: <20060524000530.152393000@localhost.localdomain> (raw)
In-Reply-To: 20060524000414.052569000@localhost.localdomain

[-- Attachment #1: llc-rcvfunc-rcu.patch --]
[-- Type: text/plain, Size: 902 bytes --]

The receive hander pointer might be modified during network changes
of protocol. So use rcu_dereference (only matters on alpha).

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
--- br.orig/net/llc/llc_input.c
+++ br/net/llc/llc_input.c
@@ -142,6 +142,8 @@ int llc_rcv(struct sk_buff *skb, struct 
 	struct llc_sap *sap;
 	struct llc_pdu_sn *pdu;
 	int dest;
+	int (*rcv)(struct sk_buff *, struct net_device *,
+		   struct packet_type *, struct net_device *);
 
 	/*
 	 * When the interface is in promisc. mode, drop all the crap that it
@@ -169,8 +171,9 @@ int llc_rcv(struct sk_buff *skb, struct 
 	 * First the upper layer protocols that don't need the full
 	 * LLC functionality
 	 */
-	if (sap->rcv_func) {
-		sap->rcv_func(skb, dev, pt, orig_dev);
+	rcv = rcu_dereference(sap->rcv_func);
+	if (rcv) {
+		rcv(skb, dev, pt, orig_dev);
 		goto out_put;
 	}
 	dest = llc_pdu_type(skb);

--


  parent reply	other threads:[~2006-05-24  0:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-24  0:04 [PATCH 0/5] LLC SOCK_DGRAM enhancements Stephen Hemminger
2006-05-24  0:04 ` [PATCH 1/5] llc: allow datagram recvmsg Stephen Hemminger
2006-05-24  0:04 ` Stephen Hemminger [this message]
2006-05-24  0:04 ` [PATCH 3/5] llc: allow applications to get copy of kernel datagrams Stephen Hemminger
2006-05-31 17:00   ` [PATCH 3/5] llc: allow applications to get copy of kernel datagrams (redo) Stephen Hemminger
2006-05-24  0:04 ` [PATCH 4/5] llc: use more efficient ether address routines Stephen Hemminger
2006-05-24  0:04 ` [PATCH 5/5] llc: add multicast support for datagrams Stephen Hemminger
2006-05-25 22:11 ` [PATCH 0/5] LLC SOCK_DGRAM enhancements David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060524000530.152393000@localhost.localdomain \
    --to=shemminger@osdl.org \
    --cc=acme@ghostprotocols.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox