From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22B1EC3DA7A for ; Wed, 28 Dec 2022 16:10:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234409AbiL1QKn (ORCPT ); Wed, 28 Dec 2022 11:10:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234561AbiL1QKG (ORCPT ); Wed, 28 Dec 2022 11:10:06 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 214EE193CF for ; Wed, 28 Dec 2022 08:08:53 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3D66AB817F6 for ; Wed, 28 Dec 2022 16:08:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5901C433D2; Wed, 28 Dec 2022 16:08:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1672243726; bh=ePLCemy2YIiZAvrzGA93uok9W6nFdUjaEHU7U60Ldvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yYCBNaCghzy+vX0rwUzcA7H/Q0KR5qAZ8VWdRrzn18Up5dJQ5kxIkZ4rCd8lX68JG RlguLdFMCx7jWKbEkC1eK4MIMfuvWpoZTW3VDe2gPo1A5AVNUSZcsVfr5qmlRPm30A Br2JiALNTxeJfGmoYlYo17gfhKQjvlJDOk0qPGv4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yang Yingliang , Simon Horman , Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 6.1 0545/1146] af_unix: call proto_unregister() in the error path in af_unix_init() Date: Wed, 28 Dec 2022 15:34:44 +0100 Message-Id: <20221228144344.976002022@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221228144330.180012208@linuxfoundation.org> References: <20221228144330.180012208@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Yang Yingliang [ Upstream commit 73e341e0281a35274629e9be27eae2f9b1b492bf ] If register unix_stream_proto returns error, unix_dgram_proto needs be unregistered. Fixes: 94531cfcbe79 ("af_unix: Add unix_stream_proto for sockmap") Signed-off-by: Yang Yingliang Reviewed-by: Simon Horman Reviewed-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/unix/af_unix.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index b3545fc68097..ede2b2a140a4 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -3738,6 +3738,7 @@ static int __init af_unix_init(void) rc = proto_register(&unix_stream_proto, 1); if (rc != 0) { pr_crit("%s: Cannot create unix_sock SLAB cache!\n", __func__); + proto_unregister(&unix_dgram_proto); goto out; } -- 2.35.1