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 X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD09FC4360F for ; Fri, 8 Mar 2019 13:08:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6F66F2064A for ; Fri, 8 Mar 2019 13:08:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552050534; bh=4+89F1E7YuZD8PHOI7nwwOxWBUVwD6AkHzwMo0v+z28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WnI12yzgXcI63CWzlIeJTTPUPcWXL73haw4TYn7wwgeXCwk0UgpQ5IE+Xel9oRHNc unvl6bn+EGy73qX0Z73sG374tpPcSKtU+TrOaL0yX3lCexK/U69mwY5Z3IQljrSugm ZYwe1xHq4+esRK0rLmDTsWxu84jxvfsIG+cqCdZA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726465AbfCHMwp (ORCPT ); Fri, 8 Mar 2019 07:52:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:56332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727002AbfCHMwl (ORCPT ); Fri, 8 Mar 2019 07:52:41 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A3B892087C; Fri, 8 Mar 2019 12:52:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552049561; bh=4+89F1E7YuZD8PHOI7nwwOxWBUVwD6AkHzwMo0v+z28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dmviQsK1RkC0GmaALPTRaf7u6WLxxEr9oloIC+PUjqqUVue47X3d/0BirzQAiWyRh PjANf2mWh9WZMWE+NLnhm5+9afrctGTT3qiNiTRNyPLnyrnBeKj9N1MbvrGlv4wTej 7pDFY8qQoWJZ6MDj5bBmg9evuhRfHgUKd+tLi3mY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sheng Yong , Gao Xiang Subject: [PATCH 5.0 09/46] staging: erofs: fix memleak of inodes shared xattr array Date: Fri, 8 Mar 2019 13:49:42 +0100 Message-Id: <20190308124902.840712758@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190308124902.257040783@linuxfoundation.org> References: <20190308124902.257040783@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 5.0-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sheng Yong commit 3b1b5291f79d040d549d7c746669fc30e8045b9b upstream. If it fails to read a shared xattr page, the inode's shared xattr array is not freed. The next time the inode's xattr is accessed, the previously allocated array is leaked. Signed-off-by: Sheng Yong Fixes: b17500a0fdba ("staging: erofs: introduce xattr & acl support") Cc: # 4.19+ Reviewed-by: Gao Xiang Signed-off-by: Greg Kroah-Hartman --- drivers/staging/erofs/xattr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/staging/erofs/xattr.c +++ b/drivers/staging/erofs/xattr.c @@ -111,8 +111,11 @@ static int init_inode_xattrs(struct inod it.page = erofs_get_meta_page(sb, ++it.blkaddr, S_ISDIR(inode->i_mode)); - if (IS_ERR(it.page)) + if (IS_ERR(it.page)) { + kfree(vi->xattr_shared_xattrs); + vi->xattr_shared_xattrs = NULL; return PTR_ERR(it.page); + } it.kaddr = kmap_atomic(it.page); atomic_map = true;