SUNRPC: Avoid deep recursion in rpc_release_client
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Tue, 12 Nov 2013 22:24:36 +0000 (17:24 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Nov 2013 19:28:09 +0000 (11:28 -0800)
commit9dae4dbe6ef3f804250d3751018c5e2ea01f6f8f
tree4d3a45d40a37d5ef56b8e7cd6ad48eb8ff28d81f
parent2181c6aa6ae9d163415d2d6ab4ec2cfaaf6f5dcb
SUNRPC: Avoid deep recursion in rpc_release_client

commit d07ba8422f1e58be94cc98a1f475946dc1b89f1b upstream.

In cases where an rpc client has a parent hierarchy, then
rpc_free_client may end up calling rpc_release_client() on the
parent, thus recursing back into rpc_free_client. If the hierarchy
is deep enough, then we can get into situations where the stack
simply overflows.

The fix is to have rpc_release_client() loop so that it can take
care of the parent rpc client hierarchy without needing to
recurse.

Reported-by: Jeff Layton <jlayton@redhat.com>
Reported-by: Weston Andros Adamson <dros@netapp.com>
Reported-by: Bruce Fields <bfields@fieldses.org>
Link: http://lkml.kernel.org/r/2C73011F-0939-434C-9E4D-13A1EB1403D7@netapp.com
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sunrpc/clnt.c