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=-12.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_PASS autolearn=ham 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 E85A1C43381 for ; Thu, 14 Feb 2019 09:47:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B757E222D2 for ; Thu, 14 Feb 2019 09:47:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550137679; bh=jKaXQifDVHqaJFGZADiK2XRU+aLNiIwcbwS/MxLcMvY=; h=Subject:To:From:Date:List-ID:From; b=azIy95kTSm8SbAncLiSlDdDG9IMXTywI4ffAQbU2bfuyyL5AWdxPOT6yz0mt4+nHa eIrJzz1BXfuPerPgKLmTjz9lXvnGKyi+Q1ifdUDaUN7HdyHF/NIJDwWlkltllQ1kTm YD8CJLAWe11glDd1Chz/4YHEB40vsXv4v5xN6VP8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388861AbfBNJr7 (ORCPT ); Thu, 14 Feb 2019 04:47:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:37510 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388835AbfBNJr7 (ORCPT ); Thu, 14 Feb 2019 04:47:59 -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 9E9D6222A4; Thu, 14 Feb 2019 09:47:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550137678; bh=jKaXQifDVHqaJFGZADiK2XRU+aLNiIwcbwS/MxLcMvY=; h=Subject:To:From:Date:From; b=JR6nzc0O44jiqdTWRI+KRuqZCjf0rCxLqRU0w9tzIf+LT3F8bOpVVCd2k0f5lAPiN h6Tn6kjTpvfcJTOinH9wIoNJJVn+XTls/SGAsPSWkNzw+0rfg9HNyoe/h2KVXrGdcF YTGwxGmWbroucJx+rr7LyWpgX9RyOxN+FcbzbY+M= Subject: patch "staging: erofs: fix memleak of inode's shared xattr array" added to staging-testing To: shengyong1@huawei.com, gaoxiang25@huawei.com, gregkh@linuxfoundation.org, stable@vger.kernel.org From: Date: Thu, 14 Feb 2019 10:47:54 +0100 Message-ID: <155013767486165@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org This is a note to let you know that I've just added the patch titled staging: erofs: fix memleak of inode's shared xattr array to my staging git tree which can be found at git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git in the staging-testing branch. The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) The patch will be merged to the staging-next branch sometime soon, after it passes testing, and the merge window is open. If you have any questions about this process, please let me know. From 3b1b5291f79d040d549d7c746669fc30e8045b9b Mon Sep 17 00:00:00 2001 From: Sheng Yong Date: Thu, 14 Feb 2019 14:46:36 +0800 Subject: staging: erofs: fix memleak of inode's shared xattr array 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(-) diff --git a/drivers/staging/erofs/xattr.c b/drivers/staging/erofs/xattr.c index e748df8d2b44..8c48b0ab31fd 100644 --- a/drivers/staging/erofs/xattr.c +++ b/drivers/staging/erofs/xattr.c @@ -111,8 +111,11 @@ static int init_inode_xattrs(struct inode *inode) 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; -- 2.20.1