Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4880540pjb; Mon, 27 Jul 2020 07:29:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBKxwws077lRBt23Ma4ji22fQRmeFQ/3IwzQ/ExhAL1GCEMVqQi7hhZQ4JmeDD4Lp/qh8E X-Received: by 2002:a17:906:6606:: with SMTP id b6mr22264750ejp.102.1595860145440; Mon, 27 Jul 2020 07:29:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595860145; cv=none; d=google.com; s=arc-20160816; b=eZLIHsrROCo9lus3NeXW0A2vDiRj4n3xGcUcgGUHNAMOlTU7ynaK76Vmp93t56+FOt kGBKyzGw4zEFa9cMjftJuHcRIZj5G3e+eA5Yw4DtBXDWkFmR1DuQrpStneQKn+PU3fB+ YHqwFdqUWJizPvlQoFp8AmC85aDsOJzPvT04gFEMfhT3K77iTWx63WOWgp2mNmfcyqZG EN0M8OY01Ri1ZIcnjUWaP6XImUuNWTW4gtEHm91ygrSw2w+Il8O8p6/yXFaj8RpOLWyb VRfg5HYLRFT1BWjBAjLQ6VwQ53tEN83gV5UyYNzt5GD/IFNDg9ENv30a0+qoQzm3Cvrm I/LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ySeSMEkaK5MmBLBKQBak6sF2vClYdNwS4wIIVWmS17k=; b=OiBsARTQDAW1MFFHJALEt/hwyOm2pHlHifLDasocw9GVHinGGQ+tPmxgPLhEzLJRYk zubjAYqxbJ+guoHL4LZ3jw/RIppCVNAw7FD6gu44+edVGiMyFmPKB0HOscY1gzrQghnD t1bQnhwkAK4cvto65Bmq957ixjCsxUl+lmXiGA/1SCl4Gjhz/fHmz2Xm0NwYyqAwBuAE A9KrSzgy3BybTHPERRgVx9gtg3UzUqJozu+lFfFx2Yjmgm6+zAxbO3qBK9mnlONWjFwV s7MLq66RA8WN8S60UjqNGgmtJBtvIhwEarOBFDgTXdYPs9n+IXB6uebDbUAFl3oMGsyv dylA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=x8x5YLse; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qp24si6181925ejb.270.2020.07.27.07.28.43; Mon, 27 Jul 2020 07:29:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=x8x5YLse; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732463AbgG0OZf (ORCPT + 99 others); Mon, 27 Jul 2020 10:25:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:55468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732439AbgG0OZ3 (ORCPT ); Mon, 27 Jul 2020 10:25:29 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 C85B02083E; Mon, 27 Jul 2020 14:25:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859928; bh=TbXNN2H51Ot2o0VSNGgDM3dKNoviQTATdC575C+5Cf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x8x5YLseXp9wD6UTmuBfUDvAVENvbDqeGhEgj/R7HXTuZs1fuvQw4t1FY27mkdYzt c6j90PCAq5gI9idFJYsLw6MHJlMBpnC396VXD7MdZV+OmMCkiiUF8gtrQMy+oEL/Yt bCYWmM+4qipawrpXXNYRIf9bwvVkESW3E6o6ZX6s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chengguang Xu , Andrew Morton , Hugh Dickins , Tejun Heo , Daniel Xu , Chris Down , Andreas Dilger , Al Viro , Linus Torvalds Subject: [PATCH 5.7 160/179] vfs/xattr: mm/shmem: kernfs: release simple xattr entry in a right way Date: Mon, 27 Jul 2020 16:05:35 +0200 Message-Id: <20200727134940.469948028@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134932.659499757@linuxfoundation.org> References: <20200727134932.659499757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chengguang Xu commit 3bef735ad7b7d987069181e7b58588043cbd1509 upstream. After commit fdc85222d58e ("kernfs: kvmalloc xattr value instead of kmalloc"), simple xattr entry is allocated with kvmalloc() instead of kmalloc(), so we should release it with kvfree() instead of kfree(). Fixes: fdc85222d58e ("kernfs: kvmalloc xattr value instead of kmalloc") Signed-off-by: Chengguang Xu Signed-off-by: Andrew Morton Acked-by: Hugh Dickins Acked-by: Tejun Heo Cc: Daniel Xu Cc: Chris Down Cc: Andreas Dilger Cc: Greg Kroah-Hartman Cc: Al Viro Cc: [5.7] Link: http://lkml.kernel.org/r/20200704051608.15043-1-cgxu519@mykernel.net Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- include/linux/xattr.h | 3 ++- mm/shmem.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) --- a/include/linux/xattr.h +++ b/include/linux/xattr.h @@ -15,6 +15,7 @@ #include #include #include +#include #include struct inode; @@ -94,7 +95,7 @@ static inline void simple_xattrs_free(st list_for_each_entry_safe(xattr, node, &xattrs->head, list) { kfree(xattr->name); - kfree(xattr); + kvfree(xattr); } } --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3205,7 +3205,7 @@ static int shmem_initxattrs(struct inode new_xattr->name = kmalloc(XATTR_SECURITY_PREFIX_LEN + len, GFP_KERNEL); if (!new_xattr->name) { - kfree(new_xattr); + kvfree(new_xattr); return -ENOMEM; }