From patchwork Sat Oct 22 07:26:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7590 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106334wrr; Sat, 22 Oct 2022 01:37:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tIvrnyz2XgjR5l5i+x2YtIB4XtBbioWZcpXXodIegi32/8q7NOVN+poGz6GV/IxI2vBig X-Received: by 2002:a17:90b:1d0e:b0:20d:a61f:84b1 with SMTP id on14-20020a17090b1d0e00b0020da61f84b1mr54075414pjb.172.1666427851982; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427851; cv=none; d=google.com; s=arc-20160816; b=CyXSAMForhyT8XKN1TTL/HdiXKbhPHQNNf1AGR361AfqFO5krZuZvzzZ2cNRMENKV+ gGjI+IEPFjIjeh5D+lGJFiZ/dZXpSbUe5zBuP6Ulpu+efQvx6hz695TnUyzO+sF8CXKM FCQPMV+HfO3BcefaPkFfNPnhWUmAcGe+s3ysXtQeLPZsvXgbDq0wlc0y1ybuABLjKWIn gG4p+fEF3ovU7eYnk2P5XyWyEPImXVXQoWTJEWSIczNp6mGH9ZEXrFQpqZSBRHvFqH4z 5JyyFn/K3SVlKEHReelTwPFRSX+tdHh2tyhyGP+6z3AndvrMpfzibl9jokZmhVu+4Aet y5lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zReY4V2wRoelfSK5JEhicprgL6PGKrJbzzQm9rIR10o=; b=MwK1zEwaj1daUr4v2kTr9T/AYov88sv0nfvqS963yMmTTrcrNzugSaepyKl1/QdV86 oIvbBQsqoQmmAI2bl/M0Dz7/DSnK4hXP53r1nI9oLgrTnrVHcCEGDpUnLESMa54rebJy cHO8eTq+2LFEl9sqGbo2JlQMLAtgm48Q1nWSQ/oKoBDmTm4ugOM0oYJcOjWtmc23Ch9M qG3lsqVqfLa+UAIIHQA3PzjoINnUcq+z9oPbVwJcjInPv5+2E2jQMyx2AASlIk5L/hMG 3Rj0nIdFGrjXqaqcoEBM7pyPXGDmuOCA4kf1T/BrfUE/R3+SLthD/OOIb0k59sVkgDDA ZI1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JNvstZjk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y1-20020a1709027c8100b00175430821b1si3736793pll.430.2022.10.22.01.37.17; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JNvstZjk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233339AbiJVIXi (ORCPT + 99 others); Sat, 22 Oct 2022 04:23:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233310AbiJVIVW (ORCPT ); Sat, 22 Oct 2022 04:21:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 774C146DAF; Sat, 22 Oct 2022 00:59:00 -0700 (PDT) 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 BCFC8B82E2E; Sat, 22 Oct 2022 07:58:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30D7DC433D6; Sat, 22 Oct 2022 07:58:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425503; bh=6WiXUIWdNpTJTFRKsmuUuF0DqLK4FwROa9QJifzyzlM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JNvstZjkZyO/LdRxKWbaNCxOKH3bXM3F/6WH2NeasAzHnOs58/0+2zc66QOyfInTQ J9YPf3yVbKjHKKg2YqNlAtJAq/gb3dd+SFL0GBCr2zNpWtG12YDUvn+I2xGGXnMu5y GT89+ns63CipFZTrqH1mEysxqVeceKYCzrgAAlyU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , "Eric W. Biederman" , Sasha Levin Subject: [PATCH 5.19 492/717] ipc: mqueue: fix possible memory leak in init_mqueue_fs() Date: Sat, 22 Oct 2022 09:26:11 +0200 Message-Id: <20221022072520.065627399@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747376251344597644?= X-GMAIL-MSGID: =?utf-8?q?1747376251344597644?= From: Hangyu Hua [ Upstream commit c579d60f0d0cd87552f64fdebe68b5d941d20309 ] commit db7cfc380900 ("ipc: Free mq_sysctls if ipc namespace creation failed") Here's a similar memory leak to the one fixed by the patch above. retire_mq_sysctls need to be called when init_mqueue_fs fails after setup_mq_sysctls. Fixes: dc55e35f9e81 ("ipc: Store mqueue sysctls in the ipc namespace") Signed-off-by: Hangyu Hua Link: https://lkml.kernel.org/r/20220715062301.19311-1-hbh25y@gmail.com Signed-off-by: Eric W. Biederman Signed-off-by: Sasha Levin --- ipc/mqueue.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 12ad7860bb88..83370fef8879 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -1746,6 +1746,7 @@ static int __init init_mqueue_fs(void) unregister_filesystem(&mqueue_fs_type); out_sysctl: kmem_cache_destroy(mqueue_inode_cachep); + retire_mq_sysctls(&init_ipc_ns); return error; }