From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Selvin Xavier <selvin.xavier@broadcom.com>,
Jason Gunthorpe <jgg@mellanox.com>,
Sasha Levin <sashal@kernel.org>,
linux-rdma@vger.kernel.org
Subject: [PATCH AUTOSEL 4.19 056/123] RDMA/bnxt_re: Avoid accessing the device structure after it is freed
Date: Wed, 5 Dec 2018 04:34:48 -0500 [thread overview]
Message-ID: <20181205093555.5386-56-sashal@kernel.org> (raw)
In-Reply-To: <20181205093555.5386-1-sashal@kernel.org>
From: Selvin Xavier <selvin.xavier@broadcom.com>
[ Upstream commit a6c66d6a08b88cc10aca9d3f65cfae31e7652a99 ]
When bnxt_re_ib_reg returns failure, the device structure gets
freed. Driver tries to access the device pointer
after it is freed.
[ 4871.034744] Failed to register with netedev: 0xffffffa1
[ 4871.034765] infiniband (null): Failed to register with IB: 0xffffffea
[ 4871.046430] ==================================================================
[ 4871.046437] BUG: KASAN: use-after-free in bnxt_re_task+0x63/0x180 [bnxt_re]
[ 4871.046439] Write of size 4 at addr ffff880fa8406f48 by task kworker/u48:2/17813
[ 4871.046443] CPU: 20 PID: 17813 Comm: kworker/u48:2 Kdump: loaded Tainted: G B OE 4.20.0-rc1+ #42
[ 4871.046444] Hardware name: Dell Inc. PowerEdge R730/0599V5, BIOS 1.0.4 08/28/2014
[ 4871.046447] Workqueue: bnxt_re bnxt_re_task [bnxt_re]
[ 4871.046449] Call Trace:
[ 4871.046454] dump_stack+0x91/0xeb
[ 4871.046458] print_address_description+0x6a/0x2a0
[ 4871.046461] kasan_report+0x176/0x2d0
[ 4871.046463] ? bnxt_re_task+0x63/0x180 [bnxt_re]
[ 4871.046466] bnxt_re_task+0x63/0x180 [bnxt_re]
[ 4871.046470] process_one_work+0x216/0x5b0
[ 4871.046471] ? process_one_work+0x189/0x5b0
[ 4871.046475] worker_thread+0x4e/0x3d0
[ 4871.046479] kthread+0x10e/0x140
[ 4871.046480] ? process_one_work+0x5b0/0x5b0
[ 4871.046482] ? kthread_stop+0x220/0x220
[ 4871.046486] ret_from_fork+0x3a/0x50
[ 4871.046492] The buggy address belongs to the page:
[ 4871.046494] page:ffffea003ea10180 count:0 mapcount:0 mapping:0000000000000000 index:0x0
[ 4871.046495] flags: 0x57ffffc0000000()
[ 4871.046498] raw: 0057ffffc0000000 0000000000000000 ffffea003ea10188 0000000000000000
[ 4871.046500] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
[ 4871.046501] page dumped because: kasan: bad access detected
Avoid accessing the device structure once it is freed.
Fixes: 497158aa5f52 ("RDMA/bnxt_re: Fix the ib_reg failure cleanup")
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/hw/bnxt_re/main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
index bb3f16273938..22bd9784fa2e 100644
--- a/drivers/infiniband/hw/bnxt_re/main.c
+++ b/drivers/infiniband/hw/bnxt_re/main.c
@@ -1462,6 +1462,7 @@ static void bnxt_re_task(struct work_struct *work)
"Failed to register with IB: %#x", rc);
bnxt_re_remove_one(rdev);
bnxt_re_dev_unreg(rdev);
+ goto exit;
}
break;
case NETDEV_UP:
@@ -1485,6 +1486,7 @@ static void bnxt_re_task(struct work_struct *work)
}
smp_mb__before_atomic();
atomic_dec(&rdev->sched_count);
+exit:
kfree(re_work);
}
--
2.17.1
next prev parent reply other threads:[~2018-12-05 9:34 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-05 9:33 [PATCH AUTOSEL 4.19 001/123] ARM: OMAP2+: prm44xx: Fix section annotation on omap44xx_prm_enable_io_wakeup Sasha Levin
2018-12-05 9:33 ` [PATCH AUTOSEL 4.19 002/123] spi: uniphier: fix incorrect property items Sasha Levin
2018-12-05 11:38 ` Mark Brown
2018-12-05 11:50 ` Sasha Levin
2018-12-05 9:33 ` [PATCH AUTOSEL 4.19 004/123] iio:st_magn: Fix enable device after trigger Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 008/123] ARM: dts: am3517: Fix pinmuxing for CD on MMC1 Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 009/123] ARM: dts: LogicPD Torpedo: Fix mmc3_dat1 interrupt Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 010/123] ARM: dts: logicpd-somlv: Fix interrupt on mmc3_dat1 Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 011/123] ARM: dts: am3517-som: Fix WL127x Wifi interrupt Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 012/123] ARM: OMAP1: ams-delta: Fix possible use of uninitialized field Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 015/123] arm64: dts: sdm845-mtp: Reserve reserved gpios Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 017/123] netfilter: nf_conncount: use spin_lock_bh instead of spin_lock Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 018/123] netfilter: nf_conncount: fix list_del corruption in conn_free Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 019/123] netfilter: nf_conncount: fix unexpected permanent node of list Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 020/123] netfilter: nf_tables: don't skip inactive chains during update Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 021/123] selftests: add script to stress-test nft packet path vs. control plane sashal
2018-12-05 9:34 ` Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 023/123] netfilter: xt_RATEEST: remove netns exit routine Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 024/123] netfilter: nf_tables: fix use-after-free when deleting compat expressions Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 025/123] s390/cio: Fix cleanup of pfn_array alloc failure Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 026/123] s390/cio: Fix cleanup when unsupported IDA format is used Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 027/123] hwmon (ina2xx) Fix NULL id pointer in probe() Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 028/123] hwmon: (raspberrypi) Fix initial notify Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 029/123] ASoC: rockchip: add missing slave_config setting for I2S Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 033/123] s390/cpum_cf: Reject request for sampling in event initialization Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 034/123] hwmon: (ina2xx) Fix current value calculation Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 035/123] ASoC: omap-abe-twl6040: Fix missing audio card caused by deferred probing Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 037/123] spi: omap2-mcspi: Add missing suspend and resume calls Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 038/123] iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbers Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 039/123] hwmon: (mlxreg-fan) Fix macros for tacho fault reading Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 041/123] aio: fix failure to put the file pointer Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 042/123] netfilter: xt_hashlimit: fix a possible memory leak in htable_create() Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 043/123] hwmon: (w83795) temp4_type has writable permission Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 045/123] PCI: imx6: Fix link training status detection in link up check Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 051/123] ARM: dts: at91: sama5d2: use the divided clock for SMC Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 052/123] Btrfs: send, fix infinite loop due to directory rename dependencies Sasha Levin
2018-12-06 17:55 ` David Sterba
2018-12-12 23:08 ` Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 053/123] RDMA/mlx5: Fix fence type for IB_WR_LOCAL_INV WR Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 054/123] RDMA/core: Add GIDs while changing MAC addr only for registered ndev Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 055/123] RDMA/bnxt_re: Fix system hang when registration with L2 driver fails Sasha Levin
2018-12-05 9:34 ` Sasha Levin [this message]
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 057/123] RDMA/rdmavt: Fix rvt_create_ah function signature Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 060/123] ASoC: omap-mcbsp: Fix latency value calculation for pm_qos Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 061/123] ASoC: omap-mcpdm: Add pm_qos handling to avoid under/overruns with CPU_IDLE Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 062/123] ASoC: omap-dmic: Add pm_qos handling to avoid overruns " Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 064/123] RDMA/hns: Bugfix pbl configuration for rereg mr Sasha Levin
2018-12-05 9:34 ` [PATCH AUTOSEL 4.19 067/123] ipvs: call ip_vs_dst_notifier earlier than ipv6_dev_notf Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 074/123] drm/meson: add support for 1080p25 mode Sasha Levin
2018-12-05 9:35 ` Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 075/123] netfilter: ipv6: Preserve link scope traffic original oif Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 076/123] IB/mlx5: Fix page fault handling for MW Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 077/123] netfilter: add missing error handling code for register functions Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 078/123] netfilter: nat: fix double register in masquerade modules Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 079/123] netfilter: nf_conncount: remove wrong condition check routine Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 080/123] KVM: VMX: Update shared MSRs to be saved/restored on MSR_EFER.LMA changes Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 081/123] KVM: x86: fix empty-body warnings Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 082/123] x86/kvm/vmx: fix old-style function declaration Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 089/123] netfilter: nf_tables: deactivate expressions in rule replecement routine Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 098/123] s390/qeth: fix length check in SNMP processing Sasha Levin
[not found] ` <20181205093555.5386-1-sashal-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 099/123] drm/amdgpu: Add delay after enable RLC ucode Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 100/123] drm/ast: fixed reading monitor EDID not stable issue Sasha Levin
2018-12-05 15:53 ` Joe Perches
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 109/123] nvme: warn when finding multi-port subsystems without multipathing enabled Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 110/123] nvme: flush namespace scanning work just before removing namespaces Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 111/123] nvme-rdma: fix double freeing of async event data Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 112/123] ACPI/IORT: Fix iort_get_platform_device_domain() uninitialized pointer value Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 116/123] mm/page_alloc.c: fix calculation of pgdat->nr_zones Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 117/123] hfs: do not free node before using Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 118/123] hfsplus: " Sasha Levin
2018-12-05 9:35 ` [PATCH AUTOSEL 4.19 120/123] proc: fixup map_files test on arm sashal
2018-12-05 9:35 ` Sasha Levin
2018-12-05 9:35 ` 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=20181205093555.5386-56-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=jgg@mellanox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=selvin.xavier@broadcom.com \
--cc=stable@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.