mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fix locking in /net/ipv4/tcp_ipv4.c
@ 2003-01-13  2:11 Anders Gustafsson
  2003-01-13  8:02 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Anders Gustafsson @ 2003-01-13  2:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: davem

Hi,

the goto-discussion* reminded me of the locking for the seq_file reading in
/net/ipv4/tcp_ipv4.c. If only the header** is read tcp_listen_unlock() is
called without the lock taken. 

*  there are some lovely gotos in /net/ipv4/tcp_ipv4.c:listening_get_next
** (void *)1 is a marker for the header.

-- 
Anders Gustafsson - andersg@0x63.nu - http://0x63.nu/

You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================


ChangeSet@1.973, 2003-01-07 03:27:31+01:00, andersg@0x63.nu
  Don't tcp_listen_unlock unless it was locked.


 tcp_ipv4.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


diff -Nru a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
--- a/net/ipv4/tcp_ipv4.c	Tue Jan  7 03:41:35 2003
+++ b/net/ipv4/tcp_ipv4.c	Tue Jan  7 03:41:35 2003
@@ -2412,7 +2412,8 @@
 			read_unlock_bh(&tp->syn_wait_lock);
 		}
 	case TCP_SEQ_STATE_LISTENING:
-		tcp_listen_unlock();
+		if (v != (void *)1)
+			tcp_listen_unlock();
 		break;
 	case TCP_SEQ_STATE_TIME_WAIT:
 	case TCP_SEQ_STATE_ESTABLISHED:

===================================================================


This BitKeeper patch contains the following changesets:
1.973
## Wrapped with gzip_uu ##


begin 664 bkpatch14669
M'XL(`%\^&CX``\V446_3,!#'G^-/<6@/K$Q-[FPG:8*"!BL"!!)5T9ZG-'&7
MJ&E<Q6X+4CX\;JDVZ%9-3#S@1+%]OIS^_OLGG\&U45WJY6VI.G/+SN"C-C;U
M\'LD_';MYE.MW3RH]%(%AZQ@H;I6-<%L$<P:O64N:Y+;HH*-6TT]\L5=Q/Y8
MJ=2;OO]P_>7ME+$L@ZLJ;V_5-V4ARYC5W29O2G.9VZK1K6^[O#5+97._T,O^
M+K7GB-P](<4"PZBG"&7<%U02Y9)4B5R.(LD.\BX/XO_\7R!AC)Q"'O8RX5'(
MQD!^$@M`$2`%&+M!RN-4T`52B@A'Y>""8(CL'?Q;T5>L@+%N7UJPQ>JFJ8U5
M[<VZ;72Q`-<I8Z"VL,T-[$*J]-EG</KCA$WNO63#OVR,88[LS1-[:94-ZM5&
M!CMINX%?_+ZK)!SU4LHH[KG@LW!>CF:)*B(4\V/O3E4Z'`J/*>DC+B3?(_)(
M\M.P/%OK`VQ.52+.)1&AY'WD9-,>((G'_%!RBA\.0_HO^/EE]5<8=MO]ZWB8
M/.;Z,[`:.X]"(/9IWW/F>?4<SC?P(G-?79?P:D`#%_4>J#T?O+Z_28I*%0NS
17F:81%(H$;.?-(*R):H$````
`
end

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

* Re: [PATCH] fix locking in /net/ipv4/tcp_ipv4.c
  2003-01-13  2:11 [PATCH] fix locking in /net/ipv4/tcp_ipv4.c Anders Gustafsson
@ 2003-01-13  8:02 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2003-01-13  8:02 UTC (permalink / raw)
  To: andersg; +Cc: linux-kernel

   From: Anders Gustafsson <andersg@0x63.nu>
   Date: Mon, 13 Jan 2003 03:11:50 +0100

   the goto-discussion* reminded me of the locking for the seq_file reading in
   /net/ipv4/tcp_ipv4.c. If only the header** is read tcp_listen_unlock() is
   called without the lock taken. 
   
Applied, thanks.

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

end of thread, other threads:[~2003-01-13  8:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-13  2:11 [PATCH] fix locking in /net/ipv4/tcp_ipv4.c Anders Gustafsson
2003-01-13  8:02 ` David S. Miller

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

Powered by JetHome