From f1c6a420b1d3167325496e16474a56a934e4ccda Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Sat, 19 Feb 2005 14:41:49 +0000 Subject: [PATCH] Reimplement recursion protection, checking whether current thread holds sockbuf mutex. Reviewed by: rwatson --- sys/netgraph/ng_ksocket.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/netgraph/ng_ksocket.c b/sys/netgraph/ng_ksocket.c index d311beb41fff..3d2179821326 100644 --- a/sys/netgraph/ng_ksocket.c +++ b/sys/netgraph/ng_ksocket.c @@ -897,6 +897,12 @@ ng_ksocket_rcvdata(hook_p hook, item_p item) struct mbuf *m; struct sa_tag *stag; + /* Avoid reentrantly sending on the socket */ + if (SOCKBUF_OWNED(&so->so_snd)) { + NG_FREE_ITEM(item); + return (EDEADLK); + } + /* Extract data */ NGI_GET_M(item, m); NG_FREE_ITEM(item);