netdev
[Top] [All Lists]

Re: [PATCH - RFC] [1/2] 2.6 must-fix list - kernel error reporting

To: Jim Keniston <jkenisto@xxxxxxxxxx>
Subject: Re: [PATCH - RFC] [1/2] 2.6 must-fix list - kernel error reporting
From: James Morris <jmorris@xxxxxxxxxxxxxxxx>
Date: Sat, 12 Jul 2003 01:37:44 +1000 (EST)
Cc: LKML <linux-kernel@xxxxxxxxxxxxxxx>, <netdev@xxxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxx>, Jeff Garzik <jgarzik@xxxxxxxxx>, Alan Cox <alan@xxxxxxxxxxxxxxxxxxx>, Randy Dunlap <rddunlap@xxxxxxxx>, <kuznet@xxxxxxxxxxxxx>
In-reply-to: <3F0DB9A5.23723BE1@xxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
On Thu, 10 Jul 2003, Jim Keniston wrote:

> James Morris wrote:
> > 
> > On Tue, 8 Jul 2003, Jim Keniston wrote:
> > 
> > +       kerror_nl = netlink_kernel_create(NETLINK_KERROR, 
> > kerror_netlink_rcv);
> > +       if (kerror_nl == NULL)
> > +               panic("kerror_init: cannot initialize kerror_nl\n");
> > 
> > You can simply use NULL instead of passing the dummy kerror_netlink_rcv
> > function.
> 
> That begs the question: do we trust that nobody but the kernel will send
> packets to a NETLINK_KERROR socket?  Ordinary users can't, but any root
> application can.  Without kerror_netlink_rcv(), such packets don't get
> dequeued.

Indeed, the kernel socket buffer fills up.

I think this needs to be addressed in the netlink code, per the patch 
below.

Comments?


- James
-- 
James Morris
<jmorris@xxxxxxxxxxxxxxxx>

diff -NurX dontdiff linux-2.5.75.orig/net/netlink/af_netlink.c 
linux-2.5.75.w1/net/netlink/af_netlink.c
--- linux-2.5.75.orig/net/netlink/af_netlink.c  2003-06-26 12:43:45.000000000 
+1000
+++ linux-2.5.75.w1/net/netlink/af_netlink.c    2003-07-12 01:23:49.708254261 
+1000
@@ -430,6 +430,10 @@
                goto no_dst;
        nlk = nlk_sk(sk);
 
+       /* Don't bother queuing skb if kernel socket has no input function */
+        if (nlk->pid == 0 && !nlk->data_ready)
+               goto no_dst;
+
 #ifdef NL_EMULATE_DEV
        if (nlk->handler) {
                skb_orphan(skb);


<Prev in Thread] Current Thread [Next in Thread>