login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
April
»
6
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close and hvc_remove
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Amit Shah
Subject:
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close and hvc_remove
Date: Tuesday, April 6, 2010 - 5:09 am
On (Tue) Apr 06 2010 [21:42:38], Anton Blanchard wrote:
quoted text
> > Hi, > > > > Looking at the commit e74d098c66543d0731de62eb747ccd5b636a6f4c, > > > i see that for every tty_kref_get() there is a corresponding > > > tty_kref_put() except maybe for the one in the following patch snippet > > > > > > spin_lock_irqsave(&hp->lock, flags); > > > /* Check and then increment for fast path open. */ > > > if (hp->count++ > 0) { > > > + tty_kref_get(tty); > > > spin_unlock_irqrestore(&hp->lock, flags); > > > hvc_kick(); > > > return 0; > > > > > > I don't know this code very well but we might be missing a > > > corresponding tty_kref_put() some place ? > > > > See hvc_hangup: > > > > temp_open_count = hp->count; > > ... > > while(temp_open_count) { > > --temp_open_count; > > tty_kref_put(tty); > > kref_put(&hp->kref, destroy_hvc_struct); > > } > > I don't claim to understand the tty layer, but it seems like hvc_open and > hvc_close should be balanced in their kref reference counting. > > Right now we get a kref every call to hvc_open: > > if (hp->count++ > 0) { > tty_kref_get(tty); <----- here > spin_unlock_irqrestore(&hp->lock, flags); > hvc_kick(); > return 0; > } /* else count == 0 */ > > tty->driver_data = hp; > > hp->tty = tty_kref_get(tty); <------ or here if hp->count was 0 > > But hvc_close has: > > tty_kref_get(tty); > > if (--hp->count == 0) { > ... > /* Put the ref obtained in hvc_open() */ > tty_kref_put(tty); > ... > } > > tty_kref_put(tty); > > Since the outside kref get/put balance we only do a single kref_put when > count reaches 0.
OK, makes sense and since it works for you, Acked-by: Amit Shah <amit.shah@redhat.com>
quoted text
> The patch below changes things to call tty_kref_put once for every > hvc_close call, and with that my machine boots fine. > > Signed-off-by: Anton Blanchard <anton@samba.org>
--
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[GIT PATCH] TTY fixes for 2.6.34-git
, Greg KH
, (Fri Mar 19, 8:13 am)
[PATCH 1/7] Revert "tty: Add a new VT mode which is like V ...
, Greg Kroah-Hartman
, (Fri Mar 19, 8:18 am)
[PATCH 2/7] tty: Take a 256 byte padding into account when ...
, Greg Kroah-Hartman
, (Fri Mar 19, 8:18 am)
[PATCH 3/7] uartlite: Fix build on sparc.
, Greg Kroah-Hartman
, (Fri Mar 19, 8:18 am)
[PATCH 4/7] hvc_console: Fix race between hvc_close and hv ...
, Greg Kroah-Hartman
, (Fri Mar 19, 8:18 am)
[PATCH 5/7] tty_buffer: Fix distinct type warning
, Greg Kroah-Hartman
, (Fri Mar 19, 8:18 am)
[PATCH 6/7] tty: cpm_uart: use resource_size()
, Greg Kroah-Hartman
, (Fri Mar 19, 8:18 am)
[PATCH 7/7] tty_port,usb-console: Fix usb serial console o ...
, Greg Kroah-Hartman
, (Fri Mar 19, 8:18 am)
Re: [PATCH 3/7] uartlite: Fix build on sparc.
, Grant Likely
, (Fri Mar 19, 9:15 am)
Re: [PATCH 3/7] uartlite: Fix build on sparc.
, Grant Likely
, (Fri Mar 19, 9:26 am)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Benjamin Herrenschmidt
, (Sat Mar 20, 2:04 pm)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Amit Shah
, (Sat Mar 20, 9:37 pm)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Benjamin Herrenschmidt
, (Wed Mar 24, 3:45 am)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Amit Shah
, (Wed Mar 24, 3:57 am)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Alan Cox
, (Wed Mar 24, 4:37 am)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Amit Shah
, (Wed Mar 24, 5:19 am)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Amit Shah
, (Wed Mar 24, 8:05 am)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Anton Blanchard
, (Thu Mar 25, 4:30 pm)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Amit Shah
, (Thu Mar 25, 7:01 pm)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Sachin Sant
, (Fri Mar 26, 2:13 am)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Amit Shah
, (Fri Mar 26, 2:58 am)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Stephen Rothwell
, (Fri Mar 26, 3:54 am)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Sachin Sant
, (Fri Mar 26, 4:42 am)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Alan Cox
, (Fri Mar 26, 4:52 am)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Amit Shah
, (Fri Mar 26, 5:43 am)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Amit Shah
, (Fri Mar 26, 5:49 am)
Re: [PATCH 3/7] uartlite: Fix build on sparc.
, Michal Simek
, (Fri Mar 26, 7:31 am)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Anton Blanchard
, (Tue Apr 6, 4:42 am)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Amit Shah
, (Tue Apr 6, 5:09 am)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Sachin Sant
, (Tue Apr 6, 5:27 am)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Alan Cox
, (Tue Apr 6, 5:32 am)
Re: [PATCH 4/7] hvc_console: Fix race between hvc_close an ...
, Rusty Russell
, (Wed Apr 7, 5:26 pm)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Fortier,Vincent [Montreal]
2.6.21.5 june 30th to july 1st date hang?
Jeff Dike
[ PATCH 2/6 ] UML - Formatting fixes around os_{read_write}_file callers
Liam Girdwood
[PATCH 07/13] regulator: regulator test harness
Oleg Nesterov
Re: Getting the new RxRPC patches upstream
Stefan Seyfried
Re: 2.6.19-rc5: grub is much slower resuming from suspend-to-disk than in 2.6.18
linux-netdev
:
Arnaud Ebalard
Re: [REGRESSION,BISECTED] MIPv6 support broken by f4f914b58019f0
Jan Engelhardt
Re: [PATCH iptables] extension: add xt_cpu match
Jarek Poplawski
Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock().
Sebastian Andrzej Siewior
[PATCH 8/8] net/emergency: remove locking from reycling pool if emergncy pools are...
David Miller
Re: [PATCH] qlcnic: dont assume NET_IP_ALIGN is 2
git
:
Jakub Narebski
Re: git on MacOSX and files with decomposed utf-8 file names
Brandon Casey
Re: Thunderbird and patches (was Re: [PATCH v2] Enable setting attach as the def...
Christian Couder
[PATCH 1/3] rev-parse: add test script for "--verify"
Ramkumar Ramachandra
Re: [GSoC update] git-remote-svn: The final one
Junio C Hamano
Re: git-rm isn't the inverse action of git-add
openbsd-misc
:
Joachim Schipper
Re: UVC Webcams
Florin Andrei
SOLVED [was: firewall is very slow, something's wrong]
Todd Alan Smith
Re: Microsoft gets the Most Secure Operating Systems award
Neal Hogan
Re: Need Advice: Thinkpad T60 or T61?
Sam Fourman Jr.
Re: Real men don't attack straw men
git-commits-head
:
Linux Kernel Mailing List
ACPI: Disable ARB_DISABLE on platforms where it is not needed
Linux Kernel Mailing List
m68knommu: add read_barrier_depends() and irqs_disabled_flags()
Linux Kernel Mailing List
[MTD] Add mtd panic_write function pointer
Linux Kernel Mailing List
[ARM] pxa: remove duplicate select statements from Kconfig
Linux Kernel Mailing List
mlx4_core: Don't read reserved fields in mlx4_QUERY_ADAPTER()
Colocation donated by:
Syndicate