netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sunrpc: fix error path - actually return ERR_PTR() on error
@ 2010-03-12 13:48 Jani Nikula
  2010-03-12 14:14 ` Tetsuo Handa
  0 siblings, 1 reply; 4+ messages in thread
From: Jani Nikula @ 2010-03-12 13:48 UTC (permalink / raw)
  To: Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA,
	bfields-uC3wQj2KruNg9hUCZPvPmw, neilb-l3A5Bk7waGM,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q
  Cc: linux-nfs-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	ext-jani.1.nikula-xNZwKgViW5gAvxtiuMwx3w

Signed-off-by: Jani Nikula <ext-jani.1.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>

---

NOTE: I'm afraid I'm unable to test this; please consider this more a
bug report than a complete patch.
---
 net/sunrpc/xprtsock.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 7124129..5b83ff9 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -2481,7 +2481,7 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args)
 	struct svc_sock *bc_sock;
 
 	if (!args->bc_xprt)
-		ERR_PTR(-EINVAL);
+		return ERR_PTR(-EINVAL);
 
 	xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries);
 	if (IS_ERR(xprt))
-- 
1.6.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] sunrpc: fix error path - actually return ERR_PTR() on error
  2010-03-12 13:48 [PATCH] sunrpc: fix error path - actually return ERR_PTR() on error Jani Nikula
@ 2010-03-12 14:14 ` Tetsuo Handa
       [not found]   ` <201003122314.IAD17160.OtJLHVMFOOSFFQ-JPay3/Yim36HaxMnTkn67Xf5DAMn2ifp@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Tetsuo Handa @ 2010-03-12 14:14 UTC (permalink / raw)
  To: ext-jani.1.nikula, Trond.Myklebust, bfields, neilb, davem,
	batsakis, bhalevy
  Cc: linux-nfs, netdev, akpm

Jani Nikula wrote:
> Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
> 
> ---
> 
> NOTE: I'm afraid I'm unable to test this; please consider this more a
> bug report than a complete patch.
> ---
Indeed, it has to be "return ERR_PTR(-EINVAL);".
Otherwise, it will trigger NULL pointer dereference some lines later.

    bc_sock = container_of(args->bc_xprt, struct svc_sock, sk_xprt);
    bc_sock->sk_bc_xprt = xprt;

This bug was introduced by f300baba5a1536070d6d77bf0c8c4ca999bb4f0f
"nfsd41: sunrpc: add new xprt class for nfsv4.1 backchannel" and
exists in 2.6.32 and later.

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

* Re: [PATCH] sunrpc: fix error path - actually return ERR_PTR() on error
       [not found]   ` <201003122314.IAD17160.OtJLHVMFOOSFFQ-JPay3/Yim36HaxMnTkn67Xf5DAMn2ifp@public.gmane.org>
@ 2010-03-12 15:09     ` Trond Myklebust
       [not found]       ` <1268406591.3156.18.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Trond Myklebust @ 2010-03-12 15:09 UTC (permalink / raw)
  To: Tetsuo Handa
  Cc: ext-jani.1.nikula-xNZwKgViW5gAvxtiuMwx3w,
	bfields-uC3wQj2KruNg9hUCZPvPmw, neilb-l3A5Bk7waGM,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q, batsakis-HgOvQuBEEgTQT0dZR+AlfA,
	bhalevy-C4P08NqkoRlBDgjK7y7TUQ, linux-nfs-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b

On Fri, 2010-03-12 at 23:14 +0900, Tetsuo Handa wrote: 
> Jani Nikula wrote:
> > Signed-off-by: Jani Nikula <ext-jani.1.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
> > 
> > ---
> > 
> > NOTE: I'm afraid I'm unable to test this; please consider this more a
> > bug report than a complete patch.
> > ---
> Indeed, it has to be "return ERR_PTR(-EINVAL);".
> Otherwise, it will trigger NULL pointer dereference some lines later.
> 
>     bc_sock = container_of(args->bc_xprt, struct svc_sock, sk_xprt);
>     bc_sock->sk_bc_xprt = xprt;
> 
> This bug was introduced by f300baba5a1536070d6d77bf0c8c4ca999bb4f0f
> "nfsd41: sunrpc: add new xprt class for nfsv4.1 backchannel" and
> exists in 2.6.32 and later.

Or it should just be dropped. I don't see any reason why nfsd should be
trying to set up a callback channel if it doesn't already know that it
has a socket. Returning an error value in that case would just be
papering over a design bug.

   Trond
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] sunrpc: fix error path - actually return ERR_PTR() on error
       [not found]       ` <1268406591.3156.18.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2010-03-12 20:35         ` J. Bruce Fields
  0 siblings, 0 replies; 4+ messages in thread
From: J. Bruce Fields @ 2010-03-12 20:35 UTC (permalink / raw)
  To: Trond Myklebust
  Cc: Tetsuo Handa, ext-jani.1.nikula-xNZwKgViW5gAvxtiuMwx3w,
	neilb-l3A5Bk7waGM, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	batsakis-HgOvQuBEEgTQT0dZR+AlfA, bhalevy-C4P08NqkoRlBDgjK7y7TUQ,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b

On Fri, Mar 12, 2010 at 10:09:51AM -0500, Trond Myklebust wrote:
> On Fri, 2010-03-12 at 23:14 +0900, Tetsuo Handa wrote: 
> > Jani Nikula wrote:
> > > Signed-off-by: Jani Nikula <ext-jani.1.nikula-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
> > > 
> > > ---
> > > 
> > > NOTE: I'm afraid I'm unable to test this; please consider this more a
> > > bug report than a complete patch.
> > > ---
> > Indeed, it has to be "return ERR_PTR(-EINVAL);".
> > Otherwise, it will trigger NULL pointer dereference some lines later.
> > 
> >     bc_sock = container_of(args->bc_xprt, struct svc_sock, sk_xprt);
> >     bc_sock->sk_bc_xprt = xprt;
> > 
> > This bug was introduced by f300baba5a1536070d6d77bf0c8c4ca999bb4f0f
> > "nfsd41: sunrpc: add new xprt class for nfsv4.1 backchannel" and
> > exists in 2.6.32 and later.
> 
> Or it should just be dropped. I don't see any reason why nfsd should be
> trying to set up a callback channel if it doesn't already know that it
> has a socket. Returning an error value in that case would just be
> papering over a design bug.

Yup.  At most it could be a BUG_ON, but it's probably better just to
delete the check.

--b.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2010-03-12 20:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-12 13:48 [PATCH] sunrpc: fix error path - actually return ERR_PTR() on error Jani Nikula
2010-03-12 14:14 ` Tetsuo Handa
     [not found]   ` <201003122314.IAD17160.OtJLHVMFOOSFFQ-JPay3/Yim36HaxMnTkn67Xf5DAMn2ifp@public.gmane.org>
2010-03-12 15:09     ` Trond Myklebust
     [not found]       ` <1268406591.3156.18.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-03-12 20:35         ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).