Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Zheyu Ma <zheyuma97@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Sasha Levin <sashal@kernel.org>,
linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 5.10 101/137] atm: nicstar: use 'dma_free_coherent' instead of 'kfree'
Date: Tue, 6 Jul 2021 07:21:27 -0400 [thread overview]
Message-ID: <20210706112203.2062605-101-sashal@kernel.org> (raw)
In-Reply-To: <20210706112203.2062605-1-sashal@kernel.org>
From: Zheyu Ma <zheyuma97@gmail.com>
[ Upstream commit 6a1e5a4af17e440dd82a58a2c5f40ff17a82b722 ]
When 'nicstar_init_one' fails, 'ns_init_card_error' will be executed for
error handling, but the correct memory free function should be used,
otherwise it will cause an error. Since 'card->rsq.org' and
'card->tsq.org' are allocated using 'dma_alloc_coherent' function, they
should be freed using 'dma_free_coherent'.
Fix this by using 'dma_free_coherent' instead of 'kfree'
This log reveals it:
[ 3.440294] kernel BUG at mm/slub.c:4206!
[ 3.441059] invalid opcode: 0000 [#1] PREEMPT SMP PTI
[ 3.441430] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 5.12.4-g70e7f0549188-dirty #141
[ 3.441986] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014
[ 3.442780] RIP: 0010:kfree+0x26a/0x300
[ 3.443065] Code: e8 3a c3 b9 ff e9 d6 fd ff ff 49 8b 45 00 31 db a9 00 00 01 00 75 4d 49 8b 45 00 a9 00 00 01 00 75 0a 49 8b 45 08 a8 01 75 02 <0f> 0b 89 d9 b8 00 10 00 00 be 06 00 00 00 48 d3 e0 f7 d8 48 63 d0
[ 3.443396] RSP: 0000:ffffc90000017b70 EFLAGS: 00010246
[ 3.443396] RAX: dead000000000100 RBX: 0000000000000000 RCX: 0000000000000000
[ 3.443396] RDX: 0000000000000000 RSI: ffffffff85d3df94 RDI: ffffffff85df38e6
[ 3.443396] RBP: ffffc90000017b90 R08: 0000000000000001 R09: 0000000000000001
[ 3.443396] R10: 0000000000000000 R11: 0000000000000001 R12: ffff888107dc0000
[ 3.443396] R13: ffffea00001f0100 R14: ffff888101a8bf00 R15: ffff888107dc0160
[ 3.443396] FS: 0000000000000000(0000) GS:ffff88817bc80000(0000) knlGS:0000000000000000
[ 3.443396] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 3.443396] CR2: 0000000000000000 CR3: 000000000642e000 CR4: 00000000000006e0
[ 3.443396] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 3.443396] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 3.443396] Call Trace:
[ 3.443396] ns_init_card_error+0x12c/0x220
[ 3.443396] nicstar_init_one+0x10d2/0x1130
[ 3.443396] local_pci_probe+0x4a/0xb0
[ 3.443396] pci_device_probe+0x126/0x1d0
[ 3.443396] ? pci_device_remove+0x100/0x100
[ 3.443396] really_probe+0x27e/0x650
[ 3.443396] driver_probe_device+0x84/0x1d0
[ 3.443396] ? mutex_lock_nested+0x16/0x20
[ 3.443396] device_driver_attach+0x63/0x70
[ 3.443396] __driver_attach+0x117/0x1a0
[ 3.443396] ? device_driver_attach+0x70/0x70
[ 3.443396] bus_for_each_dev+0xb6/0x110
[ 3.443396] ? rdinit_setup+0x40/0x40
[ 3.443396] driver_attach+0x22/0x30
[ 3.443396] bus_add_driver+0x1e6/0x2a0
[ 3.443396] driver_register+0xa4/0x180
[ 3.443396] __pci_register_driver+0x77/0x80
[ 3.443396] ? uPD98402_module_init+0xd/0xd
[ 3.443396] nicstar_init+0x1f/0x75
[ 3.443396] do_one_initcall+0x7a/0x3d0
[ 3.443396] ? rdinit_setup+0x40/0x40
[ 3.443396] ? rcu_read_lock_sched_held+0x4a/0x70
[ 3.443396] kernel_init_freeable+0x2a7/0x2f9
[ 3.443396] ? rest_init+0x2c0/0x2c0
[ 3.443396] kernel_init+0x13/0x180
[ 3.443396] ? rest_init+0x2c0/0x2c0
[ 3.443396] ? rest_init+0x2c0/0x2c0
[ 3.443396] ret_from_fork+0x1f/0x30
[ 3.443396] Modules linked in:
[ 3.443396] Dumping ftrace buffer:
[ 3.443396] (ftrace buffer empty)
[ 3.458593] ---[ end trace 3c6f8f0d8ef59bcd ]---
[ 3.458922] RIP: 0010:kfree+0x26a/0x300
[ 3.459198] Code: e8 3a c3 b9 ff e9 d6 fd ff ff 49 8b 45 00 31 db a9 00 00 01 00 75 4d 49 8b 45 00 a9 00 00 01 00 75 0a 49 8b 45 08 a8 01 75 02 <0f> 0b 89 d9 b8 00 10 00 00 be 06 00 00 00 48 d3 e0 f7 d8 48 63 d0
[ 3.460499] RSP: 0000:ffffc90000017b70 EFLAGS: 00010246
[ 3.460870] RAX: dead000000000100 RBX: 0000000000000000 RCX: 0000000000000000
[ 3.461371] RDX: 0000000000000000 RSI: ffffffff85d3df94 RDI: ffffffff85df38e6
[ 3.461873] RBP: ffffc90000017b90 R08: 0000000000000001 R09: 0000000000000001
[ 3.462372] R10: 0000000000000000 R11: 0000000000000001 R12: ffff888107dc0000
[ 3.462871] R13: ffffea00001f0100 R14: ffff888101a8bf00 R15: ffff888107dc0160
[ 3.463368] FS: 0000000000000000(0000) GS:ffff88817bc80000(0000) knlGS:0000000000000000
[ 3.463949] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 3.464356] CR2: 0000000000000000 CR3: 000000000642e000 CR4: 00000000000006e0
[ 3.464856] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 3.465356] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 3.465860] Kernel panic - not syncing: Fatal exception
[ 3.466370] Dumping ftrace buffer:
[ 3.466616] (ftrace buffer empty)
[ 3.466871] Kernel Offset: disabled
[ 3.467122] Rebooting in 1 seconds..
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/atm/nicstar.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
index 1351b05a3097..ce92ee95497a 100644
--- a/drivers/atm/nicstar.c
+++ b/drivers/atm/nicstar.c
@@ -837,10 +837,12 @@ static void ns_init_card_error(ns_dev *card, int error)
dev_kfree_skb_any(hb);
}
if (error >= 12) {
- kfree(card->rsq.org);
+ dma_free_coherent(&card->pcidev->dev, NS_RSQSIZE + NS_RSQ_ALIGNMENT,
+ card->rsq.org, card->rsq.dma);
}
if (error >= 11) {
- kfree(card->tsq.org);
+ dma_free_coherent(&card->pcidev->dev, NS_TSQSIZE + NS_TSQ_ALIGNMENT,
+ card->tsq.org, card->tsq.dma);
}
if (error >= 10) {
free_irq(card->pcidev->irq, card);
--
2.30.2
next prev parent reply other threads:[~2021-07-06 11:35 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210706112203.2062605-1-sashal@kernel.org>
2021-07-06 11:19 ` [PATCH AUTOSEL 5.10 009/137] net: pch_gbe: Use proper accessors to BE data in pch_ptp_match() Sasha Levin
2021-07-06 11:19 ` [PATCH AUTOSEL 5.10 013/137] atm: iphase: fix possible use-after-free in ia_module_exit() Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 014/137] mISDN: fix possible use-after-free in HFC_cleanup() Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 015/137] atm: nicstar: Fix possible use-after-free in nicstar_cleanup() Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 016/137] net: Treat __napi_schedule_irqoff() as __napi_schedule() on PREEMPT_RT Sasha Levin
2021-07-12 21:52 ` Pavel Machek
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 018/137] net: mdio: ipq8064: add regmap config to disable REGCACHE Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 023/137] bpf: Check for BPF_F_ADJ_ROOM_FIXED_GSO when bpf_skb_change_proto Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 024/137] net: mdio: provide shim implementation of devm_of_mdiobus_register Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 025/137] net/sched: cls_api: increase max_reclassify_loop Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 032/137] e100: handle eeprom as little endian Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 033/137] igb: handle vlan types with checker enabled Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 034/137] igb: fix assignment on big endian machines Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 037/137] net/mlx5e: IPsec/rep_tc: Fix rep_tc_update_skb drops IPsec packet Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 038/137] net/mlx5: Fix lag port remapping logic Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 041/137] net: stmmac: the XPCS obscures a potential "PHY not found" error Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 046/137] virtio-net: Add validation for used length Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 047/137] ipv6: use prandom_u32() for ID generation Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 052/137] net: tcp better handling of reordering then loss cases Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 057/137] net: bridge: mrp: Update ring transitions Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 059/137] ice: set the value of global config lock timeout longer Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 060/137] ice: fix clang warning regarding deadcode.DeadStores Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 061/137] virtio_net: Remove BUG() to avoid machine dead Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 062/137] net: mscc: ocelot: check return value after calling platform_get_resource() Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 063/137] net: bcmgenet: " Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 064/137] net: mvpp2: " Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 065/137] net: micrel: " Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 066/137] net: moxa: Use devm_platform_get_and_ioremap_resource() Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 072/137] net: phy: realtek: add delay to fix RXC generation issue Sasha Levin
2021-07-06 11:20 ` [PATCH AUTOSEL 5.10 073/137] selftests: Clean forgotten resources as part of cleanup() Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 074/137] net: sgi: ioc3-eth: check return value after calling platform_get_resource() Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 076/137] fjes: " Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 078/137] r8169: avoid link-up interrupt issue on RTL8106e if user enables ASPM Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 080/137] xfrm: Fix error reporting in xfrm_state_construct Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 082/137] wlcore/wl12xx: Fix wl12xx get_mac error if device is in ELP Sasha Levin
2021-07-12 22:03 ` Pavel Machek
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 083/137] wl1251: Fix possible buffer overflow in wl1251_cmd_scan Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 084/137] cw1200: add missing MODULE_DEVICE_TABLE Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 087/137] bpf: Fix up register-based shifts in interpreter to silence KUBSAN Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 088/137] ice: fix incorrect payload indicator on PTYPE Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 089/137] ice: mark PTYPE 2 as reserved Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 090/137] mt76: mt7615: fix fixed-rate tx status reporting Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 092/137] net: ipa: Add missing of_node_put() in ipa_firmware_load() Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 093/137] net: sched: fix error return code in tcf_del_walker() Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 097/137] mt76: mt7915: fix IEEE80211_HE_PHY_CAP7_MAX_NC for station mode Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 098/137] rtl8xxxu: Fix device info for RTL8192EU devices Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 100/137] net: fec: add ndo_select_queue to fix TX bandwidth fluctuations Sasha Levin
2021-07-06 11:21 ` Sasha Levin [this message]
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 102/137] atm: nicstar: register the interrupt handler in the right place Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 103/137] vsock: notify server to shutdown when client has pending signal Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 105/137] iwlwifi: mvm: don't change band on bound PHY contexts Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 106/137] iwlwifi: mvm: fix error print when session protection ends Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 107/137] iwlwifi: mvm: support LONG_GROUP for WOWLAN_GET_STATUSES version Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 108/137] iwlwifi: pcie: free IML DMA memory allocation Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 109/137] iwlwifi: pcie: fix context info freeing Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 110/137] sfc: avoid double pci_remove of VFs Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 111/137] sfc: error code if SRIOV cannot be disabled Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 112/137] net: dsa: b53: Create default VLAN entry explicitly Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 113/137] wireless: wext-spy: Fix out-of-bounds warning Sasha Levin
2021-07-06 14:08 ` Johannes Berg
2021-07-07 10:45 ` Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 114/137] cfg80211: fix default HE tx bitrate mask in 2G band Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 115/137] mac80211: consider per-CPU statistics if present Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 116/137] mac80211_hwsim: add concurrent channels scanning support over virtio Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 118/137] media, bpf: Do not copy more entries than user space requested Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 119/137] net: ip: avoid OOM kills with large UDP sends over loopback Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 122/137] Bluetooth: Fix the HCI to MGMT status conversion table Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 123/137] Bluetooth: Fix alt settings for incoming SCO with transparent coding format Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 124/137] Bluetooth: Shutdown controller after workqueues are flushed or cancelled Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 126/137] Bluetooth: L2CAP: Fix invalid access if ECRED Reconfigure fails Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 127/137] Bluetooth: L2CAP: Fix invalid access on ECRED Connection response Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 129/137] Bluetooth: mgmt: Fix the command returns garbage parameter value Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 132/137] bpf: Fix false positive kmemleak report in bpf_ringbuf_area_alloc() Sasha Levin
2021-07-06 11:21 ` [PATCH AUTOSEL 5.10 133/137] flow_offload: action should not be NULL when it is referenced Sasha Levin
2021-07-06 11:22 ` [PATCH AUTOSEL 5.10 134/137] sctp: validate from_addr_param return Sasha Levin
2021-07-06 11:22 ` [PATCH AUTOSEL 5.10 135/137] sctp: add size validation when walking chunks 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=20210706112203.2062605-101-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=davem@davemloft.net \
--cc=linux-atm-general@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=zheyuma97@gmail.com \
--subject='Re: [PATCH AUTOSEL 5.10 101/137] atm: nicstar: use '\''dma_free_coherent'\'' instead of '\''kfree'\''' \
/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
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).