linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Takeshi Misawa <jeliantsurux@gmail.com>,
	syzbot+d9c8bf24e56416d7ce2c@syzkaller.appspotmail.com,
	Guillaume Nault <gnault@redhat.com>,
	"David S . Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>,
	linux-ppp@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 5.2 40/63] ppp: Fix memory leak in ppp_write
Date: Tue,  1 Oct 2019 12:41:02 -0400	[thread overview]
Message-ID: <20191001164125.15398-40-sashal@kernel.org> (raw)
In-Reply-To: <20191001164125.15398-1-sashal@kernel.org>

From: Takeshi Misawa <jeliantsurux@gmail.com>

[ Upstream commit 4c247de564f1ff614d11b3bb5313fb70d7b9598b ]

When ppp is closing, __ppp_xmit_process() failed to enqueue skb
and skb allocated in ppp_write() is leaked.

syzbot reported :
BUG: memory leak
unreferenced object 0xffff88812a17bc00 (size 224):
  comm "syz-executor673", pid 6952, jiffies 4294942888 (age 13.040s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<00000000d110fff9>] kmemleak_alloc_recursive include/linux/kmemleak.h:43 [inline]
    [<00000000d110fff9>] slab_post_alloc_hook mm/slab.h:522 [inline]
    [<00000000d110fff9>] slab_alloc_node mm/slab.c:3262 [inline]
    [<00000000d110fff9>] kmem_cache_alloc_node+0x163/0x2f0 mm/slab.c:3574
    [<000000002d616113>] __alloc_skb+0x6e/0x210 net/core/skbuff.c:197
    [<000000000167fc45>] alloc_skb include/linux/skbuff.h:1055 [inline]
    [<000000000167fc45>] ppp_write+0x48/0x120 drivers/net/ppp/ppp_generic.c:502
    [<000000009ab42c0b>] __vfs_write+0x43/0xa0 fs/read_write.c:494
    [<00000000086b2e22>] vfs_write fs/read_write.c:558 [inline]
    [<00000000086b2e22>] vfs_write+0xee/0x210 fs/read_write.c:542
    [<00000000a2b70ef9>] ksys_write+0x7c/0x130 fs/read_write.c:611
    [<00000000ce5e0fdd>] __do_sys_write fs/read_write.c:623 [inline]
    [<00000000ce5e0fdd>] __se_sys_write fs/read_write.c:620 [inline]
    [<00000000ce5e0fdd>] __x64_sys_write+0x1e/0x30 fs/read_write.c:620
    [<00000000d9d7b370>] do_syscall_64+0x76/0x1a0 arch/x86/entry/common.c:296
    [<0000000006e6d506>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

Fix this by freeing skb, if ppp is closing.

Fixes: 6d066734e9f0 ("ppp: avoid loop in xmit recursion detection code")
Reported-and-tested-by: syzbot+d9c8bf24e56416d7ce2c@syzkaller.appspotmail.com
Signed-off-by: Takeshi Misawa <jeliantsurux@gmail.com>
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Tested-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ppp/ppp_generic.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index a30e41a560853..9a1b006904a7d 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -1415,6 +1415,8 @@ static void __ppp_xmit_process(struct ppp *ppp, struct sk_buff *skb)
 			netif_wake_queue(ppp->dev);
 		else
 			netif_stop_queue(ppp->dev);
+	} else {
+		kfree_skb(skb);
 	}
 	ppp_xmit_unlock(ppp);
 }
-- 
2.20.1


  parent reply	other threads:[~2019-10-01 16:42 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-01 16:40 [PATCH AUTOSEL 5.2 01/63] drivers: thermal: qcom: tsens: Fix memory leak from qfprom read Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 02/63] ima: always return negative code for error Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 03/63] ima: fix freeing ongoing ahash_request Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 04/63] fs: nfs: Fix possible null-pointer dereferences in encode_attrs() Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 05/63] xprtrdma: Send Queue size grows after a reconnect Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 06/63] 9p: Transport error uninitialized Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 07/63] 9p: avoid attaching writeback_fid on mmap with type PRIVATE Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 08/63] 9p/cache.c: Fix memory leak in v9fs_cache_session_get_cookie Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 09/63] xen/pci: reserve MCFG areas earlier Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 10/63] fuse: fix request limit Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 11/63] ceph: fix directories inode i_blkbits initialization Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 12/63] ceph: fetch cap_gen under spinlock in ceph_add_cap Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 13/63] ceph: reconnect connection if session hang in opening state Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 14/63] rbd: fix response length parameter for encoded strings Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 15/63] SUNRPC: RPC level errors should always set task->tk_rpc_status Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 16/63] watchdog: aspeed: Add support for AST2600 Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 17/63] netfilter: nf_tables: allow lookups in dynamic sets Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 18/63] drm/amdgpu: Fix KFD-related kernel oops on Hawaii Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 19/63] drm/amdgpu: Check for valid number of registers to read Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 20/63] pNFS: Ensure we do clear the return-on-close layout stateid on fatal errors Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 21/63] SUNRPC: Don't try to parse incomplete RPC messages Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 22/63] net/sched: act_sample: don't push mac header on ip6gre ingress Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 23/63] pwm: stm32-lp: Add check in case requested period cannot be achieved Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 24/63] cdc_ncm: fix divide-by-zero caused by invalid wMaxPacketSize Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 25/63] usbnet: ignore endpoints with " Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 26/63] net/phy: fix DP83865 10 Mbps HDX loopback disable function Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 27/63] net_sched: add max len check for TCA_KIND Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 28/63] x86/purgatory: Disable the stackleak GCC plugin for the purgatory Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 29/63] ntb: point to right memory window index Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 30/63] thermal: Fix use-after-free when unregistering thermal zone device Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 31/63] thermal_hwmon: Sanitize thermal_zone type Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 32/63] iommu/amd: Fix downgrading default page-sizes in alloc_pte() Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 33/63] libnvdimm/region: Initialize bad block for volatile namespaces Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 34/63] net/mlx5e: Fix traffic duplication in ethtool steering Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 35/63] KVM: hyperv: Fix Direct Synthetic timers assert an interrupt w/o lapic_in_kernel Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 36/63] libnvdimm: Fix endian conversion issues Sasha Levin
2019-10-01 16:40 ` [PATCH AUTOSEL 5.2 37/63] fuse: fix memleak in cuse_channel_open Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 38/63] arcnet: provide a buffer big enough to actually receive packets Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 39/63] libnvdimm/nfit_test: Fix acpi_handle redefinition Sasha Levin
2019-10-01 16:41 ` Sasha Levin [this message]
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 41/63] sched/membarrier: Call sync_core only before usermode for same mm Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 42/63] sched/membarrier: Fix private expedited registration check Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 43/63] sched/core: Fix migration to invalid CPU in __set_cpus_allowed_ptr() Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 44/63] perf build: Add detection of java-11-openjdk-devel package Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 45/63] include/trace/events/writeback.h: fix -Wstringop-truncation warnings Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 46/63] kernel/elfcore.c: include proper prototypes Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 47/63] kexec: bail out upon SIGKILL when allocating memory Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 48/63] blk-mq: move lockdep_assert_held() into elevator_exit Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 49/63] bpf: Fix bpf_event_output re-entry issue Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 50/63] macsec: drop skb sk before calling gro_cells_receive Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 51/63] i2c: qcom-geni: Disable DMA processing on the Lenovo Yoga C630 Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 52/63] perf unwind: Fix libunwind build failure on i386 systems Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 53/63] nfp: flower: fix memory leak in nfp_flower_spawn_vnic_reprs Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 54/63] net: phy: micrel: add Asym Pause workaround for KSZ9021 Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 55/63] mlxsw: spectrum_flower: Fail in case user specifies multiple mirror actions Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 56/63] vrf: Do not attempt to create IPv6 mcast rule if IPv6 is disabled Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 57/63] nfp: flower: prevent memory leak in nfp_flower_spawn_phy_reprs Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 58/63] nfp: abm: fix memory leak in nfp_abm_u32_knode_replace Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 59/63] fuse: fix deadlock with aio poll and fuse_iqueue::waitq.lock Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 60/63] drm/radeon: Bail earlier when radeon.cik_/si_support=0 is passed Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 61/63] usbnet: sanity checking of packet sizes and device mtu Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 62/63] sch_netem: fix a divide by zero in tabledist() Sasha Levin
2019-10-01 16:41 ` [PATCH AUTOSEL 5.2 63/63] Btrfs: fix selftests failure due to uninitialized i_mode in test inodes Sasha Levin

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=20191001164125.15398-40-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=davem@davemloft.net \
    --cc=gnault@redhat.com \
    --cc=jeliantsurux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-ppp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+d9c8bf24e56416d7ce2c@syzkaller.appspotmail.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).