Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754031AbbEZNQ1 (ORCPT ); Tue, 26 May 2015 09:16:27 -0400 Received: from a.ns.miles-group.at ([95.130.255.143]:65275 "EHLO radon.swed.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752730AbbEZNQG (ORCPT ); Tue, 26 May 2015 09:16:06 -0400 Message-ID: <55645910.9010706@nod.at> Date: Tue, 26 May 2015 13:29:20 +0200 From: Richard Weinberger User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Chao Yu , dedekind1@gmail.com, adrian.hunter@intel.com CC: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ubifs: fix to check error code of register_shrinker References: <003001d09146$c124b150$436e13f0$@samsung.com> <000301d097a6$6f3f9e70$4dbedb50$@samsung.com> In-Reply-To: <000301d097a6$6f3f9e70$4dbedb50$@samsung.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1981 Lines: 64 Am 26.05.2015 um 13:23 schrieb Chao Yu: > Ping. > > Add Cc Richard Weinberger. Patch looks good to me. Artem, if you don't mind I'd pick it up for the 4.2 queue. Thanks, //richard >> -----Original Message----- >> From: linux-mtd [mailto:linux-mtd-bounces@lists.infradead.org] On Behalf Of Chao Yu >> Sent: Monday, May 18, 2015 4:43 PM >> To: dedekind1@gmail.com; adrian.hunter@intel.com >> Cc: linux-mtd@lists.infradead.org; linux-kernel@vger.kernel.org >> Subject: [PATCH] ubifs: fix to check error code of register_shrinker >> >> register_shrinker() in ubifs_init() can fail due to fail to call kzalloc. >> This patch fixes to check the return value of register_shrinker, otherwise >> our shrinker may be unregistered after ubifs initialized successfully. >> >> Signed-off-by: Chao Yu >> --- >> fs/ubifs/super.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c >> index 75e6f04..fa83d1b 100644 >> --- a/fs/ubifs/super.c >> +++ b/fs/ubifs/super.c >> @@ -2245,7 +2245,9 @@ static int __init ubifs_init(void) >> if (!ubifs_inode_slab) >> return -ENOMEM; >> >> - register_shrinker(&ubifs_shrinker_info); >> + err = register_shrinker(&ubifs_shrinker_info); >> + if (err) >> + goto out_slab; >> >> err = ubifs_compressors_init(); >> if (err) >> @@ -2269,6 +2271,7 @@ out_compr: >> ubifs_compressors_exit(); >> out_shrinker: >> unregister_shrinker(&ubifs_shrinker_info); >> +out_slab: >> kmem_cache_destroy(ubifs_inode_slab); >> return err; >> } >> -- >> 2.3.3 >> >> >> >> ______________________________________________________ >> Linux MTD discussion mailing list >> http://lists.infradead.org/mailman/listinfo/linux-mtd/ > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/