Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp178045ybc; Mon, 18 Nov 2019 22:52:01 -0800 (PST) X-Google-Smtp-Source: APXvYqxAqKpJHcjLkcv6+kX2AVvzvYZP+0w/vkK7zD3nlwFPV8gnsYdLciTq+2s1N3AYRsJwAfJK X-Received: by 2002:a17:906:5f81:: with SMTP id a1mr32644266eju.54.1574146321493; Mon, 18 Nov 2019 22:52:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574146321; cv=none; d=google.com; s=arc-20160816; b=Pxv7/KUU0fi7+y5FAMX3MPcdLFfJtCeTb9or66wnpOlGSetLzKrHq+QYgS0NkYIZPD SMsC0xts6DiPXUcUewJDQVOwppvXfrVbGAdzZbuOaysR0nwXs6JTb3OB+d56c6b36tkM /Qxk1uPMgoeipnjiAYXUlDhffWNFyStnR8CpUvjp/ZSIL1bU+M71AF8PtMpUuu1YfDKU ge01+7nnugDo04wcQpMyB2dP18bfP2IfttfjX0Es9dkHU86h9D0CslBhaMOJCJ4RBbt8 Ic0Pj/wUXxDJI9xMdM4C02zyVKh5jPW2yjdtah0Vt9NmT1bA1nen36PrJjs8CGb0tpEh Tk1Q== 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=eMj/SawGSgVScRg1h2aHClpAP6j4sNND/YOT65h+ds8=; b=EtmetrkaTHAm9nl1bMux3I1oxxVVYvVp9jl9TpjUKGAsghRtNXjBZt1xqdz1mYW7P/ iK6EHs/lT19awlQQK1KUL33c3+oq695hT+T+P0hL5+OSEehQxF7KWSxhDb3oum9MPFsH 2lu7QKhbfC71Sx9i0hgIpFTekhOf6zZCuElp/lBO3GQfozNrycbqgWSS+uX2ZSOqMMWv AJxWVOJV7+A1JOO1mUy38okRj438kst3IjE4E/F0Ewok0dfYHS8KnRAxH66jFrNaATTE eUncxifLgC+oV+xQNP9JconJ7vLeQMsy+YtAjF9z1V1qYk7oYDInnvtwqEUrv/UZVUiE xCcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=D9bPvoIC; 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 c13si14232457edv.320.2019.11.18.22.51.36; Mon, 18 Nov 2019 22:52:01 -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=D9bPvoIC; 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 S1728446AbfKSFZq (ORCPT + 99 others); Tue, 19 Nov 2019 00:25:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:43526 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728435AbfKSFZn (ORCPT ); Tue, 19 Nov 2019 00:25:43 -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 9929E222DC; Tue, 19 Nov 2019 05:25:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574141142; bh=tu0Rc8b6GxVmN+U6FBQh53szbTYC73ta5z5AP/vLPUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D9bPvoICD1GfxaAX5Eel8+o7BzhziiJ4OYaLDrKvxwOkfa6L4BddEyX6shOZG+Wig rcRthvNhIJm3ujl8RyL/dKLzvtYfnQvN7m6Ylb3WPemJR8cpoaSXug1R5msJuh21Tx oPvruHbMII7v7QnGXz3bpEKgn8b9AMjqxUx7VRqM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "David S. Miller" , Oliver Hartkopp , Lukas Bulwahn , Jouni Hogander Subject: [PATCH 4.19 008/422] slip: Fix memory leak in slip_open error path Date: Tue, 19 Nov 2019 06:13:25 +0100 Message-Id: <20191119051400.750600561@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119051400.261610025@linuxfoundation.org> References: <20191119051400.261610025@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: Jouni Hogander [ Upstream commit 3b5a39979dafea9d0cd69c7ae06088f7a84cdafa ] Driver/net/can/slcan.c is derived from slip.c. Memory leak was detected by Syzkaller in slcan. Same issue exists in slip.c and this patch is addressing the leak in slip.c. Here is the slcan memory leak trace reported by Syzkaller: BUG: memory leak unreferenced object 0xffff888067f65500 (size 4096): comm "syz-executor043", pid 454, jiffies 4294759719 (age 11.930s) hex dump (first 32 bytes): 73 6c 63 61 6e 30 00 00 00 00 00 00 00 00 00 00 slcan0.......... 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<00000000a06eec0d>] __kmalloc+0x18b/0x2c0 [<0000000083306e66>] kvmalloc_node+0x3a/0xc0 [<000000006ac27f87>] alloc_netdev_mqs+0x17a/0x1080 [<0000000061a996c9>] slcan_open+0x3ae/0x9a0 [<000000001226f0f9>] tty_ldisc_open.isra.1+0x76/0xc0 [<0000000019289631>] tty_set_ldisc+0x28c/0x5f0 [<000000004de5a617>] tty_ioctl+0x48d/0x1590 [<00000000daef496f>] do_vfs_ioctl+0x1c7/0x1510 [<0000000059068dbc>] ksys_ioctl+0x99/0xb0 [<000000009a6eb334>] __x64_sys_ioctl+0x78/0xb0 [<0000000053d0332e>] do_syscall_64+0x16f/0x580 [<0000000021b83b99>] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [<000000008ea75434>] 0xfffffffffffffff Cc: "David S. Miller" Cc: Oliver Hartkopp Cc: Lukas Bulwahn Signed-off-by: Jouni Hogander Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/slip/slip.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/slip/slip.c +++ b/drivers/net/slip/slip.c @@ -855,6 +855,7 @@ err_free_chan: sl->tty = NULL; tty->disc_data = NULL; clear_bit(SLF_INUSE, &sl->flags); + free_netdev(sl->dev); err_exit: rtnl_unlock();