diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index e70e843ee48f..7e484f5b140c 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c @@ -851,8 +851,10 @@ static int p9_socket_open(struct p9_client *client, struct socket *csocket) struct file *file; p = kzalloc(sizeof(struct p9_trans_fd), GFP_KERNEL); - if (!p) + if (!p) { + sock_release(csocket); return -ENOMEM; + } csocket->sk->sk_allocation = GFP_NOIO; file = sock_alloc_file(csocket, 0, NULL);