Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932315AbbEZNiI (ORCPT ); Tue, 26 May 2015 09:38:08 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:61624 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932256AbbEZNiE (ORCPT ); Tue, 26 May 2015 09:38:04 -0400 X-AuditID: cbfee61a-f79516d000006302-5c-556457c42459 From: Chao Yu To: dedekind1@gmail.com, adrian.hunter@intel.com, richard@nod.at Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org References: <003001d09146$c124b150$436e13f0$@samsung.com> In-reply-to: <003001d09146$c124b150$436e13f0$@samsung.com> Subject: RE: [PATCH] ubifs: fix to check error code of register_shrinker Date: Tue, 26 May 2015 19:23:02 +0800 Message-id: <000301d097a6$6f3f9e70$4dbedb50$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AQKAW6gbULxSxFH/39oy//rLJgTKg5wulN3A Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMLMWRmVeSWpSXmKPExsVy+t9jAd0j4SmhBiduylucfLKGzeJW92tG i8u75rBZ7G5axm4xeecbRgdWj52z7rJ7LN7zkslj85J6j5vzCj0+b5ILYI3isklJzcksSy3S t0vgypi16hVjwT6eig23X7A0MC7n6mLk5JAQMJHY8nAaM4QtJnHh3nq2LkYuDiGBRYwSZx41 soMkhAReMUq8vBYDYrMJqEgs7/jPBGKLCDhIvNg+mRXEZhawlzi1eCtUvaXElJezwGo4Bawk OrfcAlsgLOAh8enhRDCbRUBVYtaiFywgNi9Q/aSvDxghbEGJH5PvsUDM1JJYv/M4E4QtL7F5 zVuoQxUkdpx9zQhxg5HEzlNP2CFqxCU2HrnFMoFRaBaSUbOQjJqFZNQsJC0LGFlWMYqmFiQX FCel5xrqFSfmFpfmpesl5+duYgRHxTOpHYwrGywOMQpwMCrx8FocTg4VYk0sK67MPcQowcGs JMKbHZQSKsSbklhZlVqUH19UmpNafIhRmoNFSZz3ZL5PqJBAemJJanZqakFqEUyWiYNTqoGR 4/ZdpV8ffM++55nF/slymmpo5Iln3Etn3GE61ySywPy2xKn2q+fnLr3DXRP7nV00km/V/EY9 1SgflptLvx13XJX8YeUd/xe8P6aI/XTeE/CKLe+feWlXxN+ZcbKbTuyY/3Xzsg9+E7pTlzvO LfE6fnWn/JrtKzninNMcj4UbOZfplqrd5EzKVGIpzkg01GIuKk4EAEqs2iOGAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1791 Lines: 57 Ping. Add Cc Richard Weinberger. > -----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/