Re: [PATCH v2] sock: fix potential memory leak in proto_register()

From: David Miller
Date: Thu Aug 22 2019 - 18:44:10 EST


From: zhanglin <zhang.lin16@xxxxxxxxxx>
Date: Wed, 21 Aug 2019 08:42:38 +0800

> @@ -3243,18 +3245,24 @@ int proto_register(struct proto *prot, int alloc_slab)
> }
>
> mutex_lock(&proto_list_mutex);
> + if (assign_proto_idx(prot)) {
> + mutex_unlock(&proto_list_mutex);
> + goto out_free_timewait_sock_slab_name;
> + }

Propagate the error code properly please.