If devfs_set_cdevpriv() fails, we will panic when we enter the
cuse_client_free() callback, for a number of reasons:
- pcc->server is not yet assigned, so we'll use a NULL pointer.
- pcc has not yet been added to the pcs->hcli TAILQ, but we'll try to remove it.
- pccmd->sx and pccmd->cv are not yet initializated, but we'll try to destroy them.
Even if we'd get past all these somehow, we'd still get two errors in
the devfs_set_cdevpriv() failure block:
- We'll unref the server twice, once in cuse_client_free(), and again in cuse_client_open().
- A double-free panic, since we'd be trying to free(pcc), which has already been freed in cuse_client_free().
Fix all those issues. While here, also get rid of some unnecessary
devfs_clear_cdevpriv().
Sponsored by: The FreeBSD Foundation
MFC after: 1 week