Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6473788ybc; Wed, 27 Nov 2019 23:43:51 -0800 (PST) X-Google-Smtp-Source: APXvYqzPSlPA7z8tTLX8SsLx3gViswl5LvZzR59yMQHA+sc3K4iuFffRQbo7KLxUETxUt3FaqDgd X-Received: by 2002:a05:6402:3136:: with SMTP id dd22mr4050161edb.129.1574927031844; Wed, 27 Nov 2019 23:43:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574927031; cv=none; d=google.com; s=arc-20160816; b=SkYSE2UOwcwF65Asa9Hoy9W6AUZJuqGKvgr38V7ZR7TFh6Jlozm8jr98wZVgVioUxY k0PkU8YLoBZQMl/7V+PwPNNQY4C0ZW33olm++fJR9xhY4EoPT/bNAz67eE7TAmtB9S/n z7bHxDFtlg5P8f9cNAHH1bLap2oH922wHtcGIVAZ0iLTiBDZmwTnEYQA99SpZYfabdzN 0jxWY/uZrq1RqTjUWhD7P60zLtKg0uTwjz27TBSRcLUzvdxukiR3xcZJEmX+Gu9kLMwr Um70K8tTHkfApA+l5V+aCYZ7t5mpsfn02AHhY9F6AzSNVyRYRDev9fszegCA9j731x0d wmWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2ZCUNaDkVQ3gkX+0pXxO1+qeP0pCf80F/J1mHwhv4KA=; b=Qz/EhBZEE9AXZv/fPPqZiS92h3abgOp/xA3vqrRBm6QsruIArUnKa/cjnyDx2OPBHV uzjq/COFU0AYHKJdVsgbfX0oG1mDnIgmJ3ZWrBpaoj6Npf8KhIaDLBGA9n5424B/b98z YL/jvUpJXzabO1jfVrtdQgp4LZeaNE2TCuSLHMmaZ58VXbrqGEJaI6xYwDa/cJXmnmQw EI0SQ/N8l8217xEIfF3QD0evDq0h+ziHod/mHL/2BT+F2cJkvYuWqSMtRuFEjEom8pDU UyKyJVxkM2au1r11FPrLwi+SooHUgNIwGSPoavEPyFG1UqlAXuP7Cn6ZWI3b+/DXeCai cKXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="a6D/MqZW"; 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 j1si6264945edh.399.2019.11.27.23.43.28; Wed, 27 Nov 2019 23:43:51 -0800 (PST) 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="a6D/MqZW"; 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 S1727266AbfK1Hh4 (ORCPT + 99 others); Thu, 28 Nov 2019 02:37:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:58196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727142AbfK1Hh4 (ORCPT ); Thu, 28 Nov 2019 02:37:56 -0500 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 29A932168B; Thu, 28 Nov 2019 07:37:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574926675; bh=/x6FQ3ngN2ChmVvaEh2WWu7L67kYDuJUqi8t3X4tz3Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=a6D/MqZWmGb27EcZreH5VhTEhVHsS2C2DZ0OYVyWi5fEuzxbYp4wVGnnLtYbFFZQn C8O477RVTieVdOXAVdWSCUS+spGC5U4mBKiXljr0qlNtmTE0yJFb058jXywRjQIq6a yRsGOH86bDZK6PuOBUAbRkb6C/V1kbMbTpVS3HFY= Date: Thu, 28 Nov 2019 08:35:31 +0100 From: Greg Kroah-Hartman To: Nobuhiro Iwamatsu Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, David Miller , Lukas Bulwahn , Jouni Hogander Subject: Re: [PATCH 4.19 282/306] net-sysfs: Fix reference count leak in rx|netdev_queue_add_kobject Message-ID: <20191128073531.GD3317872@kroah.com> References: <20191127203114.766709977@linuxfoundation.org> <20191127203135.382666831@linuxfoundation.org> <20191128033302.riq5c55kt7mre3vw@toshiba.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191128033302.riq5c55kt7mre3vw@toshiba.co.jp> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 28, 2019 at 12:33:02PM +0900, Nobuhiro Iwamatsu wrote: > Hi, > > On Wed, Nov 27, 2019 at 09:32:12PM +0100, Greg Kroah-Hartman wrote: > > From: Jouni Hogander > > > > commit b8eb718348b8fb30b5a7d0a8fce26fb3f4ac741b upstream. > > > > kobject_init_and_add takes reference even when it fails. This has > > to be given up by the caller in error handling. Otherwise memory > > allocated by kobject_init_and_add is never freed. Originally found > > by Syzkaller: > > > > BUG: memory leak > > unreferenced object 0xffff8880679f8b08 (size 8): > > comm "netdev_register", pid 269, jiffies 4294693094 (age 12.132s) > > hex dump (first 8 bytes): > > 72 78 2d 30 00 36 20 d4 rx-0.6 . > > backtrace: > > [<000000008c93818e>] __kmalloc_track_caller+0x16e/0x290 > > [<000000001f2e4e49>] kvasprintf+0xb1/0x140 > > [<000000007f313394>] kvasprintf_const+0x56/0x160 > > [<00000000aeca11c8>] kobject_set_name_vargs+0x5b/0x140 > > [<0000000073a0367c>] kobject_init_and_add+0xd8/0x170 > > [<0000000088838e4b>] net_rx_queue_update_kobjects+0x152/0x560 > > [<000000006be5f104>] netdev_register_kobject+0x210/0x380 > > [<00000000e31dab9d>] register_netdevice+0xa1b/0xf00 > > [<00000000f68b2465>] __tun_chr_ioctl+0x20d5/0x3dd0 > > [<000000004c50599f>] tun_chr_ioctl+0x2f/0x40 > > [<00000000bbd4c317>] do_vfs_ioctl+0x1c7/0x1510 > > [<00000000d4c59e8f>] ksys_ioctl+0x99/0xb0 > > [<00000000946aea81>] __x64_sys_ioctl+0x78/0xb0 > > [<0000000038d946e5>] do_syscall_64+0x16f/0x580 > > [<00000000e0aa5d8f>] entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > [<00000000285b3d1a>] 0xffffffffffffffff > > > > Cc: David Miller > > Cc: Lukas Bulwahn > > Signed-off-by: Jouni Hogander > > Signed-off-by: David S. Miller > > Signed-off-by: Greg Kroah-Hartman > > > > We also need the following commits to fix this issue: > > commit 48a322b6f9965b2f1e4ce81af972f0e287b07ed0 > Author: Eric Dumazet > Date: Wed Nov 20 19:19:07 2019 -0800 > > net-sysfs: fix netdev_queue_add_kobject() breakage > > kobject_put() should only be called in error path. > > Fixes: b8eb718348b8 ("net-sysfs: Fix reference count leak in rx|netdev_queue_add_kobject") > Signed-off-by: Eric Dumazet > Cc: Jouni Hogander > Signed-off-by: David S. Miller > > And this should also apply to 4.14.y and 5.3.y. > Please apply this commnit to 4.14.y, 4.19.y and 5.3.y Thanks for the report, will go queue it up now. greg k-h