Subject: Re: [RFC] net: netlink -- Allow netlink_dump to return error code if protocol handler is missed

From: Cyrill Gorcunov <[email-masked]>
Date: Sat, 3 Nov 2012 20:39:58 +0400

On Sat, Nov 03, 2012 at 08:17:50PM +0400, Pavel Emelyanov wrote:
> >  static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
> > Index: linux-2.6.git/net/netlink/af_netlink.c
> > ===================================================================
> > --- linux-2.6.git.orig/net/netlink/af_netlink.c
> > +++ linux-2.6.git/net/netlink/af_netlink.c
> > @@ -1740,6 +1740,10 @@ static int netlink_dump(struct sock *sk)
> >  		else
> >  			__netlink_sendskb(sk, skb);
> >  		return 0;
> > +	} else if (len < 0) {
> > +		err = len;
> > +		nlk->cb = NULL;
> > +		goto errout_skb;
> 
> When family-level handler is absent and sock_diag returns error this error
> gets propagated back to user without this fix. Why do we need it in case
> we return error from protocol-level handler?

Because as far as I can say the family-level handler already has such error
returning code in __sock_diag_rcv_msg. Or you mean something else?

	Cyrill