public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] uml: Safely iterate list of winch handlers in line driver.
@ 2010-11-13 17:44 Will Newton
  2010-11-18 12:18 ` richard -rw- weinberger
  2010-11-18 13:43 ` Américo Wang
  0 siblings, 2 replies; 3+ messages in thread
From: Will Newton @ 2010-11-13 17:44 UTC (permalink / raw)
  To: Linux Kernel list, user-mode-linux-devel, Jeff Dike

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

unregister_winch should use list_for_each_safe, as it can
potentially delete from the list.

Signed-off-by: Will Newton <will.newton@gmail.com>
---
 arch/um/drivers/line.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 7f7338c..5f12fef 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -820,12 +820,12 @@ void register_winch_irq(int fd, int tty_fd, int
pid, struct tty_struct *tty,

 static void unregister_winch(struct tty_struct *tty)
 {
-	struct list_head *ele;
+	struct list_head *ele, *next;
 	struct winch *winch;

 	spin_lock(&winch_handler_lock);

-	list_for_each(ele, &winch_handlers) {
+	list_for_each_safe(ele, next, &winch_handlers) {
 		winch = list_entry(ele, struct winch, list);
 		if (winch->tty == tty) {
 			free_winch(winch, 1);
-- 
1.7.0.4

[-- Attachment #2: 0001-uml-Safely-iterate-list-of-winch-handlers-in-line-dr.patch --]
[-- Type: text/x-patch, Size: 1098 bytes --]

From e579eb5835a0730177388545520f21d9fbc0de1e Mon Sep 17 00:00:00 2001
From: Will Newton <will.newton@gmail.com>
Date: Sat, 13 Nov 2010 16:30:58 +0000
Subject: [PATCH 1/2] uml: Safely iterate list of winch handlers in line driver.

unregister_winch should use list_for_each_safe, as it can
potentially delete from the list.

Signed-off-by: Will Newton <will.newton@gmail.com>
---
 arch/um/drivers/line.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 7f7338c..5f12fef 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -820,12 +820,12 @@ void register_winch_irq(int fd, int tty_fd, int pid, struct tty_struct *tty,
 
 static void unregister_winch(struct tty_struct *tty)
 {
-	struct list_head *ele;
+	struct list_head *ele, *next;
 	struct winch *winch;
 
 	spin_lock(&winch_handler_lock);
 
-	list_for_each(ele, &winch_handlers) {
+	list_for_each_safe(ele, next, &winch_handlers) {
 		winch = list_entry(ele, struct winch, list);
 		if (winch->tty == tty) {
 			free_winch(winch, 1);
-- 
1.7.0.4


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

end of thread, other threads:[~2010-11-18 13:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-13 17:44 [PATCH 1/2] uml: Safely iterate list of winch handlers in line driver Will Newton
2010-11-18 12:18 ` richard -rw- weinberger
2010-11-18 13:43 ` Américo Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox