stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	syzbot+f90a420dfe2b1b03cb2c@syzkaller.appspotmail.com,
	Shakeel Butt <shakeelb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	Kirill Tkhai <ktkhai@virtuozzo.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 4.4 42/84] mm/list_lru.c: fix memory leak in __memcg_init_list_lru_node
Date: Thu, 20 Jun 2019 19:56:39 +0200	[thread overview]
Message-ID: <20190620174344.583952251@linuxfoundation.org> (raw)
In-Reply-To: <20190620174337.538228162@linuxfoundation.org>

From: Shakeel Butt <shakeelb@google.com>

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 <shakeelb@google.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Cc: <stable@vger.kernel.org>	[4.0+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 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;
 }
 



  parent reply	other threads:[~2019-06-20 18:30 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-20 17:55 [PATCH 4.4 00/84] 4.4.183-stable review Greg Kroah-Hartman
2019-06-20 17:55 ` [PATCH 4.4 01/84] fs/fat/file.c: issue flush after the writeback of FAT Greg Kroah-Hartman
2019-06-20 17:55 ` [PATCH 4.4 02/84] sysctl: return -EINVAL if val violates minmax Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 03/84] ipc: prevent lockup on alloc_msg and free_msg Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 04/84] hugetlbfs: on restore reserve error path retain subpool reservation Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 05/84] mm/cma.c: fix crash on CMA allocation if bitmap allocation fails Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 06/84] mm/cma_debug.c: fix the break condition in cma_maxchunk_get() Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 07/84] kernel/sys.c: prctl: fix false positive in validate_prctl_map() Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 08/84] mfd: intel-lpss: Set the device in reset state when init Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 09/84] mfd: twl6040: Fix device init errors for ACCCTL register Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 10/84] perf/x86/intel: Allow PEBS multi-entry in watermark mode Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 11/84] drm/bridge: adv7511: Fix low refresh rate selection Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 12/84] ntp: Allow TAI-UTC offset to be set to zero Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 13/84] f2fs: fix to avoid panic in do_recover_data() Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 14/84] f2fs: fix to do sanity check on valid block count of segment Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 15/84] iommu/vt-d: Set intel_iommu_gfx_mapped correctly Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 16/84] ALSA: hda - Register irq handler after the chip initialization Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 17/84] nvmem: core: fix read buffer in place Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 18/84] fuse: retrieve: cap requested size to negotiated max_write Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 19/84] nfsd: allow fh_want_write to be called twice Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 20/84] x86/PCI: Fix PCI IRQ routing table memory leak Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 21/84] platform/chrome: cros_ec_proto: check for NULL transfer function Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 22/84] soc: mediatek: pwrap: Zero initialize rdata in pwrap_init_cipher Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 23/84] clk: rockchip: Turn on "aclk_dmac1" for suspend on rk3288 Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 24/84] ARM: dts: imx6sx: Specify IMX6SX_CLK_IPG as "ahb" clock to SDMA Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 25/84] ARM: dts: imx6sx: Specify IMX6SX_CLK_IPG as "ipg" " Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 26/84] ARM: dts: imx6qdl: Specify IMX6QDL_CLK_IPG " Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 27/84] PCI: rpadlpar: Fix leaked device_node references in add/remove paths Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 28/84] PCI: rcar: Fix a potential NULL pointer dereference Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 29/84] video: hgafb: fix " Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 30/84] video: imsttfb: fix potential NULL pointer dereferences Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 31/84] PCI: xilinx: Check for __get_free_pages() failure Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 32/84] gpio: gpio-omap: add check for off wake capable gpios Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 33/84] dmaengine: idma64: Use actual device for DMA transfers Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 34/84] pwm: tiehrpwm: Update shadow register for disabling PWMs Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 35/84] ARM: dts: exynos: Always enable necessary APIO_1V8 and ABB_1V8 regulators on Arndale Octa Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 36/84] pwm: Fix deadlock warning when removing PWM device Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 37/84] ARM: exynos: Fix undefined instruction during Exynos5422 resume Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 38/84] futex: Fix futex lock the wrong page Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 39/84] Revert "Bluetooth: Align minimum encryption key size for LE and BR/EDR connections" Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 40/84] ALSA: seq: Cover unsubscribe_port() in list_mutex Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 41/84] libata: Extend quirks for the ST1000LM024 drives with NOLPM quirk Greg Kroah-Hartman
2019-06-20 17:56 ` Greg Kroah-Hartman [this message]
2019-06-20 17:56 ` [PATCH 4.4 43/84] fs/ocfs2: fix race in ocfs2_dentry_attach_lock() Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 44/84] [PATCH] signal/ptrace: Dont leak unitialized kernel memory with PTRACE_PEEK_SIGINFO Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 45/84] ptrace: restore smp_rmb() in __ptrace_may_access() Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 46/84] i2c: acorn: fix i2c warning Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 47/84] bcache: fix stack corruption by PRECEDING_KEY() Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 48/84] cgroup: Use css_tryget() instead of css_tryget_online() in task_get_css() Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 49/84] ASoC: cs42xx8: Add regcache mask dirty Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 50/84] Drivers: misc: fix out-of-bounds access in function param_set_kgdbts_var Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 51/84] scsi: lpfc: add check for loss of ndlp when sending RRQ Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 52/84] scsi: bnx2fc: fix incorrect cast to u64 on shift operation Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 53/84] usbnet: ipheth: fix racing condition Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 54/84] KVM: x86/pmu: do not mask the value that is written to fixed PMUs Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 55/84] KVM: s390: fix memory slot handling for KVM_SET_USER_MEMORY_REGION Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 56/84] drm/vmwgfx: integer underflow in vmw_cmd_dx_set_shader() leading to an invalid read Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 57/84] drm/vmwgfx: NULL pointer dereference from vmw_cmd_dx_view_define() Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 58/84] USB: Fix chipmunk-like voice when using Logitech C270 for recording audio Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 59/84] USB: usb-storage: Add new ID to ums-realtek Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 60/84] USB: serial: pl2303: add Allied Telesis VT-Kit3 Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 61/84] USB: serial: option: add support for Simcom SIM7500/SIM7600 RNDIS mode Greg Kroah-Hartman
2019-06-20 17:56 ` [PATCH 4.4 62/84] USB: serial: option: add Telit 0x1260 and 0x1261 compositions Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 63/84] ax25: fix inconsistent lock state in ax25_destroy_timer Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 64/84] be2net: Fix number of Rx queues used for flow hashing Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 65/84] ipv6: flowlabel: fl6_sock_lookup() must use atomic_inc_not_zero Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 66/84] lapb: fixed leak of control-blocks Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 67/84] neigh: fix use-after-free read in pneigh_get_next Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 68/84] sunhv: Fix device naming inconsistency between sunhv_console and sunhv_reg Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 69/84] mISDN: make sure device name is NUL terminated Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 70/84] x86/CPU/AMD: Dont force the CPB cap when running under a hypervisor Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 71/84] perf/ring_buffer: Fix exposing a temporarily decreased data_head Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 72/84] perf/ring_buffer: Add ordering to rb->nest increment Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 73/84] gpio: fix gpio-adp5588 build errors Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 74/84] net: tulip: de4x5: Drop redundant MODULE_DEVICE_TABLE() Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 75/84] i2c: dev: fix potential memory leak in i2cdev_ioctl_rdwr Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 76/84] configfs: Fix use-after-free when accessing sd->s_dentry Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 77/84] ia64: fix build errors by exporting paddr_to_nid() Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 78/84] KVM: PPC: Book3S: Use new mutex to synchronize access to rtas token list Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 79/84] net: sh_eth: fix mdio access in sh_eth_close() for R-Car Gen2 and RZ/A1 SoCs Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 80/84] scsi: libcxgbi: add a check for NULL pointer in cxgbi_check_route() Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 81/84] scsi: libsas: delete sas port if expander discover failed Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 82/84] Revert "crypto: crypto4xx - properly set IV after de- and encrypt" Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 83/84] coredump: fix race condition between mmget_not_zero()/get_task_mm() and core dumping Greg Kroah-Hartman
2019-06-20 17:57 ` [PATCH 4.4 84/84] Abort file_remove_privs() for non-reg. files Greg Kroah-Hartman
2019-06-20 22:11 ` [PATCH 4.4 00/84] 4.4.183-stable review kernelci.org bot
2019-06-21  3:57 ` Naresh Kamboju
2019-06-22  0:43 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190620174344.583952251@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=ktkhai@virtuozzo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.com \
    --cc=shakeelb@google.com \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+f90a420dfe2b1b03cb2c@syzkaller.appspotmail.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).