FreeBSD Bugzilla – Attachment 243150 Details for
Bug 272319
FreeBSD kernel crash on MPD5 restart with PPP configuration.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix panic and try to add solisten upcall
ng_ksocket_fix_panic_and_add_solisten_upcall.diff (text/plain), 2.11 KB, created by
Aleksandr Fedorov
on 2023-07-02 17:01:54 UTC
(
hide
)
Description:
Fix panic and try to add solisten upcall
Filename:
MIME Type:
Creator:
Aleksandr Fedorov
Created:
2023-07-02 17:01:54 UTC
Size:
2.11 KB
patch
obsolete
>diff --git a/sys/netgraph/ng_ksocket.c b/sys/netgraph/ng_ksocket.c >index ff5e7b4812bf..b9e8d4e2415c 100644 >--- a/sys/netgraph/ng_ksocket.c >+++ b/sys/netgraph/ng_ksocket.c >@@ -154,6 +154,7 @@ static const struct ng_ksocket_alias ng_ksocket_protos[] = { > > /* Helper functions */ > static int ng_ksocket_accept(priv_p); >+static int ng_ksocket_listen_upcall(struct socket *so, void *arg, int waitflag); > static int ng_ksocket_incoming(struct socket *so, void *arg, int waitflag); > static int ng_ksocket_parse(const struct ng_ksocket_alias *aliases, > const char *s, int family); >@@ -720,8 +721,21 @@ ng_ksocket_rcvmsg(node_p node, item_p item, hook_p lasthook) > * the connection when it comes in. > */ > error = ng_ksocket_accept(priv); >+ > if (error != 0 && error != EWOULDBLOCK) > ERROUT(error); >+ >+ /* >+ * Clear the error if it equal zero or EWOULDBLOCK, >+ * to not shoking MPD5. >+ */ >+ error = 0; >+ >+ /* Setup upcall to get events from new incoming connections */ >+ SOLISTEN_LOCK(priv->so); >+ solisten_upcall_set(priv->so, ng_ksocket_listen_upcall, priv); >+ SOLISTEN_UNLOCK(priv->so); >+ > priv->response_token = msg->header.token; > priv->response_addr = NGI_RETADDR(item); > break; >@@ -935,12 +949,14 @@ ng_ksocket_shutdown(node_p node) > > /* Close our socket (if any) */ > if (priv->so != NULL) { >- SOCKBUF_LOCK(&priv->so->so_rcv); >- soupcall_clear(priv->so, SO_RCV); >- SOCKBUF_UNLOCK(&priv->so->so_rcv); >- SOCKBUF_LOCK(&priv->so->so_snd); >- soupcall_clear(priv->so, SO_SND); >- SOCKBUF_UNLOCK(&priv->so->so_snd); >+ if (!SOLISTENING(priv->so)) { >+ SOCKBUF_LOCK(&priv->so->so_rcv); >+ soupcall_clear(priv->so, SO_RCV); >+ SOCKBUF_UNLOCK(&priv->so->so_rcv); >+ SOCKBUF_LOCK(&priv->so->so_snd); >+ soupcall_clear(priv->so, SO_SND); >+ SOCKBUF_UNLOCK(&priv->so->so_snd); >+ } > soclose(priv->so); > priv->so = NULL; > } >@@ -1245,6 +1261,14 @@ ng_ksocket_accept(priv_p priv) > return (0); > } > >+static >+int ng_ksocket_listen_upcall(struct socket *so, void *arg, int waitflag) >+{ >+ priv_p priv = arg; >+ >+ return (ng_ksocket_accept(priv)); >+} >+ > /* > * Parse out either an integer value or an alias. > */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 272319
: 243150 |
243879
|
246427