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, Eric Dumazet <edumazet@google.com>,
	syzbot <syzkaller@googlegroups.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 5.0 08/36] llc: fix skb leak in llc_build_and_send_ui_pkt()
Date: Mon,  3 Jun 2019 11:08:56 +0200	[thread overview]
Message-ID: <20190603090521.505143571@linuxfoundation.org> (raw)
In-Reply-To: <20190603090520.998342694@linuxfoundation.org>

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 8fb44d60d4142cd2a440620cd291d346e23c131e ]

If llc_mac_hdr_init() returns an error, we must drop the skb
since no llc_build_and_send_ui_pkt() caller will take care of this.

BUG: memory leak
unreferenced object 0xffff8881202b6800 (size 2048):
  comm "syz-executor907", pid 7074, jiffies 4294943781 (age 8.590s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    1a 00 07 40 00 00 00 00 00 00 00 00 00 00 00 00  ...@............
  backtrace:
    [<00000000e25b5abe>] kmemleak_alloc_recursive include/linux/kmemleak.h:55 [inline]
    [<00000000e25b5abe>] slab_post_alloc_hook mm/slab.h:439 [inline]
    [<00000000e25b5abe>] slab_alloc mm/slab.c:3326 [inline]
    [<00000000e25b5abe>] __do_kmalloc mm/slab.c:3658 [inline]
    [<00000000e25b5abe>] __kmalloc+0x161/0x2c0 mm/slab.c:3669
    [<00000000a1ae188a>] kmalloc include/linux/slab.h:552 [inline]
    [<00000000a1ae188a>] sk_prot_alloc+0xd6/0x170 net/core/sock.c:1608
    [<00000000ded25bbe>] sk_alloc+0x35/0x2f0 net/core/sock.c:1662
    [<000000002ecae075>] llc_sk_alloc+0x35/0x170 net/llc/llc_conn.c:950
    [<00000000551f7c47>] llc_ui_create+0x7b/0x140 net/llc/af_llc.c:173
    [<0000000029027f0e>] __sock_create+0x164/0x250 net/socket.c:1430
    [<000000008bdec225>] sock_create net/socket.c:1481 [inline]
    [<000000008bdec225>] __sys_socket+0x69/0x110 net/socket.c:1523
    [<00000000b6439228>] __do_sys_socket net/socket.c:1532 [inline]
    [<00000000b6439228>] __se_sys_socket net/socket.c:1530 [inline]
    [<00000000b6439228>] __x64_sys_socket+0x1e/0x30 net/socket.c:1530
    [<00000000cec820c1>] do_syscall_64+0x76/0x1a0 arch/x86/entry/common.c:301
    [<000000000c32554f>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

BUG: memory leak
unreferenced object 0xffff88811d750d00 (size 224):
  comm "syz-executor907", pid 7074, jiffies 4294943781 (age 8.600s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 f0 0c 24 81 88 ff ff 00 68 2b 20 81 88 ff ff  ...$.....h+ ....
  backtrace:
    [<0000000053026172>] kmemleak_alloc_recursive include/linux/kmemleak.h:55 [inline]
    [<0000000053026172>] slab_post_alloc_hook mm/slab.h:439 [inline]
    [<0000000053026172>] slab_alloc_node mm/slab.c:3269 [inline]
    [<0000000053026172>] kmem_cache_alloc_node+0x153/0x2a0 mm/slab.c:3579
    [<00000000fa8f3c30>] __alloc_skb+0x6e/0x210 net/core/skbuff.c:198
    [<00000000d96fdafb>] alloc_skb include/linux/skbuff.h:1058 [inline]
    [<00000000d96fdafb>] alloc_skb_with_frags+0x5f/0x250 net/core/skbuff.c:5327
    [<000000000a34a2e7>] sock_alloc_send_pskb+0x269/0x2a0 net/core/sock.c:2225
    [<00000000ee39999b>] sock_alloc_send_skb+0x32/0x40 net/core/sock.c:2242
    [<00000000e034d810>] llc_ui_sendmsg+0x10a/0x540 net/llc/af_llc.c:933
    [<00000000c0bc8445>] sock_sendmsg_nosec net/socket.c:652 [inline]
    [<00000000c0bc8445>] sock_sendmsg+0x54/0x70 net/socket.c:671
    [<000000003b687167>] __sys_sendto+0x148/0x1f0 net/socket.c:1964
    [<00000000922d78d9>] __do_sys_sendto net/socket.c:1976 [inline]
    [<00000000922d78d9>] __se_sys_sendto net/socket.c:1972 [inline]
    [<00000000922d78d9>] __x64_sys_sendto+0x2a/0x30 net/socket.c:1972
    [<00000000cec820c1>] do_syscall_64+0x76/0x1a0 arch/x86/entry/common.c:301
    [<000000000c32554f>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/llc/llc_output.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/net/llc/llc_output.c
+++ b/net/llc/llc_output.c
@@ -72,6 +72,8 @@ int llc_build_and_send_ui_pkt(struct llc
 	rc = llc_mac_hdr_init(skb, skb->dev->dev_addr, dmac);
 	if (likely(!rc))
 		rc = dev_queue_xmit(skb);
+	else
+		kfree_skb(skb);
 	return rc;
 }
 



  parent reply	other threads:[~2019-06-03  9:16 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03  9:08 [PATCH 5.0 00/36] 5.0.21-stable review Greg Kroah-Hartman
2019-06-03  9:08 ` [PATCH 5.0 01/36] bonding/802.3ad: fix slave link initialization transition states Greg Kroah-Hartman
2019-06-03  9:08 ` [PATCH 5.0 02/36] cxgb4: offload VLAN flows regardless of VLAN ethtype Greg Kroah-Hartman
2019-06-03  9:08 ` [PATCH 5.0 03/36] inet: switch IP ID generator to siphash Greg Kroah-Hartman
2019-06-03  9:08 ` [PATCH 5.0 04/36] ipv4/igmp: fix another memory leak in igmpv3_del_delrec() Greg Kroah-Hartman
2019-06-03  9:08 ` [PATCH 5.0 05/36] ipv4/igmp: fix build error if !CONFIG_IP_MULTICAST Greg Kroah-Hartman
2019-06-03  9:08 ` [PATCH 5.0 06/36] ipv6: Consider sk_bound_dev_if when binding a raw socket to an address Greg Kroah-Hartman
2019-06-03  9:08 ` [PATCH 5.0 07/36] ipv6: Fix redirect with VRF Greg Kroah-Hartman
2019-06-03  9:08 ` Greg Kroah-Hartman [this message]
2019-06-03  9:08 ` [PATCH 5.0 09/36] mlxsw: spectrum_acl: Avoid warning after identical rules insertion Greg Kroah-Hartman
2019-06-03  9:08 ` [PATCH 5.0 10/36] net: dsa: mv88e6xxx: fix handling of upper half of STATS_TYPE_PORT Greg Kroah-Hartman
2019-06-03  9:08 ` [PATCH 5.0 11/36] net: fec: fix the clk mismatch in failed_reset path Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 12/36] net-gro: fix use-after-free read in napi_gro_frags() Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 13/36] net: mvneta: Fix err code path of probe Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 14/36] net: mvpp2: fix bad MVPP2_TXQ_SCHED_TOKEN_CNTR_REG queue value Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 15/36] net: phy: marvell10g: report if the PHY fails to boot firmware Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 16/36] net: sched: dont use tc_action->order during action dump Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 17/36] net: stmmac: fix reset gpio free missing Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 18/36] r8169: fix MAC address being lost in PCI D3 Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 19/36] usbnet: fix kernel crash after disconnect Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 20/36] net/mlx5: Avoid double free in fs init error unwinding path Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 21/36] tipc: Avoid copying bytes beyond the supplied data Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 22/36] net/mlx5: Allocate root ns memory using kzalloc to match kfree Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 23/36] net/mlx5e: Disable rxhash when CQE compress is enabled Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 25/36] net: stmmac: dma channel control register need to be init first Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 26/36] bnxt_en: Fix aggregation buffer leak under OOM condition Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 27/36] bnxt_en: Fix possible BUG() condition when calling pci_disable_msix() Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 28/36] bnxt_en: Reduce memory usage when running in kdump kernel Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 29/36] net/tls: fix state removal with feature flags off Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 30/36] net/tls: dont ignore netdev notifications if no TLS features Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 31/36] cxgb4: Revert "cxgb4: Remove SGE_HOST_PAGE_SIZE dependency on page size" Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 32/36] net: correct zerocopy refcnt with udp MSG_MORE Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 33/36] crypto: vmx - ghash: do nosimd fallback manually Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 34/36] xen/pciback: Dont disable PCI_COMMAND on PCI device reset Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 35/36] Revert "tipc: fix modprobe tipc failed after switch order of device registration" Greg Kroah-Hartman
2019-06-03  9:09 ` [PATCH 5.0 36/36] tipc: fix modprobe tipc failed after switch order of device registration Greg Kroah-Hartman
2019-06-03 15:09 ` [PATCH 5.0 00/36] 5.0.21-stable review kernelci.org bot
2019-06-03 17:17 ` Guenter Roeck
2019-06-03 17:59 ` Naresh Kamboju
2019-06-03 18:33 ` Jon Hunter
2019-06-03 23:32 ` shuah

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=20190603090521.505143571@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=syzkaller@googlegroups.com \
    /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).