All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@domain.hid>
To: xenomai-core <xenomai@xenomai.org>
Subject: [Xenomai-core] [PATCH] RT-Socket-CAN:
Date: Wed, 22 Aug 2007 13:21:24 +0200	[thread overview]
Message-ID: <46CC1C34.9050205@domain.hid> (raw)

[-- Attachment #1: Type: text/plain, Size: 291 bytes --]

Hello,

the following patch fixes:

2007-08-22  Wolfgang Grandegger  <wg@domain.hid>

         * ksrc/drivers/can/rtcan_socket.c: protect the list of sockets
         per device properly when adding or deleting sockets.

It should be applied to Xenomai's trunk and v2.3.x branch.

Wolfgang.

[-- Attachment #2: xenomai-rtcan-socket-list.patch --]
[-- Type: text/x-patch, Size: 1747 bytes --]

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 2945)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2007-08-22  Wolfgang Grandegger  <wg@domain.hid>
+
+	* ksrc/drivers/can/rtcan_socket.c: protect the list of sockets
+	per device properly when adding or deleting sockets.
+
 2007-08-18  Philippe Gerum  <rpm@xenomai.org>
 
 	* RELEASE: Xenomai 2.4-rc2
Index: ksrc/drivers/can/rtcan_socket.c
===================================================================
--- ksrc/drivers/can/rtcan_socket.c	(revision 2945)
+++ ksrc/drivers/can/rtcan_socket.c	(working copy)
@@ -37,6 +37,7 @@ LIST_HEAD(rtcan_socket_list);
 void rtcan_socket_init(struct rtdm_dev_context *context)
 {
     struct rtcan_socket *sock = (struct rtcan_socket *)&context->dev_private;
+    rtdm_lockctx_t lock_ctx;
 
 
     rtdm_sem_init(&sock->recv_sem, 0);
@@ -56,7 +57,10 @@ void rtcan_socket_init(struct rtdm_dev_c
     sock->rx_timeout = RTDM_TIMEOUT_INFINITE;
 
     INIT_LIST_HEAD(&sock->tx_wait_head);
+
+    rtdm_lock_get_irqsave(&rtcan_socket_lock, lock_ctx);
     list_add(&sock->socket_list, &rtcan_socket_list);
+    rtdm_lock_put_irqrestore(&rtcan_socket_lock, lock_ctx);
 }
 
 
@@ -64,6 +68,7 @@ void rtcan_socket_cleanup(struct rtdm_de
 {
     struct rtcan_socket *sock = (struct rtcan_socket *)&context->dev_private;
     struct tx_wait_queue *tx_waiting;
+    rtdm_lockctx_t lock_ctx;
     int tx_list_empty;
 
 
@@ -91,5 +96,8 @@ void rtcan_socket_cleanup(struct rtdm_de
     } while (!tx_list_empty);
 
     rtdm_sem_destroy(&sock->recv_sem);
+
+    rtdm_lock_get_irqsave(&rtcan_socket_lock, lock_ctx);
     list_del(&sock->socket_list);
+    rtdm_lock_put_irqrestore(&rtcan_socket_lock, lock_ctx);
 }

                 reply	other threads:[~2007-08-22 11:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=46CC1C34.9050205@domain.hid \
    --to=wg@domain.hid \
    --cc=xenomai@xenomai.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 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.