Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3007390ybi; Mon, 17 Jun 2019 14:33:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIZiLRuBgXnFtuxAipuYUdoOERXxJfkt0We9UYcJIzGw7X+JlDeMm+kRAZEmdY2nSWlkjX X-Received: by 2002:a17:902:ba94:: with SMTP id k20mr19324640pls.266.1560807189925; Mon, 17 Jun 2019 14:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560807189; cv=none; d=google.com; s=arc-20160816; b=qzSy59DM6hgrbA2K3ebsKKThBXwSwID2gTP9DslV4IkFKm8kWif+D3rXJhhBv4kGOq VtHa/A32Wf6oZol/4XmVv7WWF/4BwDiG5mkPMnlAi54pK+otbnE2AEGuwijQxXeoMKWL NVdis/ytNHWSqwBnEGooCBvL6kisD9ymKlXX+fGPJlftVaiJkuEWCWK7GwC1bsS83mhs yZ5T/UCdfiw1lvYL59nu8QP7Wq2JHm0oXks0q94w/iiBdDnr4mmC3wZgqvvnips+yZs2 RdAMP3oR1KIM9ROIe4VAhtbNHJZpR3t9wYcmBBe1KZc6vBEIqlCXJAiFAFCgT1zKZOjc bpuw== 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=nCepaL7NUFQvZpx1PXmESlIUW/3qmUgyV2zuezIxDzQ=; b=zZk8TMQNZxXHb9Y/eYpQqsZi2ZC73nfH0t+k2g/4ls6fKV49DcYu02xVahIIGL/5hS mSaAlwEgWBtQnEDVemeVW3R77IvA4wAxN+Cd/+8etDiLXQ9QGSc8EBByPDpAiYWN/1b6 iZPYqtgfj1hVYR8UZMR3OKLQvvwRMww05aUc1lG7kgam/IM8PsCsDp5g4JfResZw0QCY h2/pnL1CB0omf5SoukCMgySlUPPx3ixTBR3i8Ov6zCZpHFxb/2XPiuPHXXFysa2rDT5F IbpEdBgLOIcGofAmX7n7e7OFolYyNqswfZnsvnUQlqV9Y6/1vlxlJponZhMgLGL3+3Zo uQqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pvk2SXmS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 16si11464971pfo.12.2019.06.17.14.32.54; Mon, 17 Jun 2019 14:33:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pvk2SXmS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730595AbfFQV2s (ORCPT + 99 others); Mon, 17 Jun 2019 17:28:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:55834 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730583AbfFQV2o (ORCPT ); Mon, 17 Jun 2019 17:28:44 -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 7BF55204FD; Mon, 17 Jun 2019 21:28:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560806923; bh=4EQFF575OSksr+Czwy7Daf1KcxUt6KdPuAr8LL/g0+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pvk2SXmSG1nFIwWL8oGotrs9MgoWFLsNqoetPh9T7KVW9wDAir9ICa2Y6I1GtsQig cwfWGJuG8hPGLJCRAycJNU5x5IxruzUyCi31PcfPcWCIL0pncpnbKfeurg7ABmVLq7 bE3rfy3DXt2bbucFaULfDIRFLwoJxwNHhLXyQkBU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+f90a420dfe2b1b03cb2c@syzkaller.appspotmail.com, Shakeel Butt , Michal Hocko , Kirill Tkhai , Andrew Morton , Linus Torvalds Subject: [PATCH 4.14 09/53] mm/list_lru.c: fix memory leak in __memcg_init_list_lru_node Date: Mon, 17 Jun 2019 23:09:52 +0200 Message-Id: <20190617210746.973024958@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190617210745.104187490@linuxfoundation.org> References: <20190617210745.104187490@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: Shakeel Butt commit 3510955b327176fd4cbab5baa75b449f077722a2 upstream. Syzbot reported following memory leak: ffffffffda RBX: 0000000000000003 RCX: 0000000000441f79 BUG: memory leak unreferenced object 0xffff888114f26040 (size 32): comm "syz-executor626", pid 7056, jiffies 4294948701 (age 39.410s) hex dump (first 32 bytes): 40 60 f2 14 81 88 ff ff 40 60 f2 14 81 88 ff ff @`......@`...... 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: slab_post_alloc_hook mm/slab.h:439 [inline] slab_alloc mm/slab.c:3326 [inline] kmem_cache_alloc_trace+0x13d/0x280 mm/slab.c:3553 kmalloc include/linux/slab.h:547 [inline] __memcg_init_list_lru_node+0x58/0xf0 mm/list_lru.c:352 memcg_init_list_lru_node mm/list_lru.c:375 [inline] memcg_init_list_lru mm/list_lru.c:459 [inline] __list_lru_init+0x193/0x2a0 mm/list_lru.c:626 alloc_super+0x2e0/0x310 fs/super.c:269 sget_userns+0x94/0x2a0 fs/super.c:609 sget+0x8d/0xb0 fs/super.c:660 mount_nodev+0x31/0xb0 fs/super.c:1387 fuse_mount+0x2d/0x40 fs/fuse/inode.c:1236 legacy_get_tree+0x27/0x80 fs/fs_context.c:661 vfs_get_tree+0x2e/0x120 fs/super.c:1476 do_new_mount fs/namespace.c:2790 [inline] do_mount+0x932/0xc50 fs/namespace.c:3110 ksys_mount+0xab/0x120 fs/namespace.c:3319 __do_sys_mount fs/namespace.c:3333 [inline] __se_sys_mount fs/namespace.c:3330 [inline] __x64_sys_mount+0x26/0x30 fs/namespace.c:3330 do_syscall_64+0x76/0x1a0 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x44/0xa9 This is a simple off by one bug on the error path. Link: http://lkml.kernel.org/r/20190528043202.99980-1-shakeelb@google.com Fixes: 60d3fd32a7a9 ("list_lru: introduce per-memcg lists") Reported-by: syzbot+f90a420dfe2b1b03cb2c@syzkaller.appspotmail.com Signed-off-by: Shakeel Butt Acked-by: Michal Hocko Reviewed-by: Kirill Tkhai Cc: [4.0+] Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/list_lru.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/list_lru.c +++ b/mm/list_lru.c @@ -313,7 +313,7 @@ static int __memcg_init_list_lru_node(st } return 0; fail: - __memcg_destroy_list_lru_node(memcg_lrus, begin, i - 1); + __memcg_destroy_list_lru_node(memcg_lrus, begin, i); return -ENOMEM; }