From: Simon Horman <simon.horman@corigine.com>
To: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Cc: pmenzel@molgen.mpg.de, netdev@vger.kernel.org,
intel-wired-lan@lists.osuosl.org,
Przemek Kitszel <przemyslaw.kitszel@intel.com>
Subject: Re: [Intel-wired-lan] [PATCH iwl-net v3] ice: prevent NULL pointer deref during reload
Date: Tue, 11 Jul 2023 17:33:13 +0100 [thread overview]
Message-ID: <ZK2ESQIcppzGDa80@corigine.com> (raw)
In-Reply-To: <20230706062551.2261312-1-michal.swiatkowski@linux.intel.com>
On Thu, Jul 06, 2023 at 08:25:51AM +0200, Michal Swiatkowski wrote:
> Calling ethtool during reload can lead to call trace, because VSI isn't
> configured for some time, but netdev is alive.
>
> To fix it add rtnl lock for VSI deconfig and config. Set ::num_q_vectors
> to 0 after freeing and add a check for ::tx/rx_rings in ring related
> ethtool ops.
>
> Add proper unroll of filters in ice_start_eth().
>
> Reproduction:
> $watch -n 0.1 -d 'ethtool -g enp24s0f0np0'
> $devlink dev reload pci/0000:18:00.0 action driver_reinit
>
> Call trace before fix:
> [66303.926205] BUG: kernel NULL pointer dereference, address: 0000000000000000
> [66303.926259] #PF: supervisor read access in kernel mode
> [66303.926286] #PF: error_code(0x0000) - not-present page
> [66303.926311] PGD 0 P4D 0
> [66303.926332] Oops: 0000 [#1] PREEMPT SMP PTI
> [66303.926358] CPU: 4 PID: 933821 Comm: ethtool Kdump: loaded Tainted: G OE 6.4.0-rc5+ #1
> [66303.926400] Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.00.01.0014.070920180847 07/09/2018
> [66303.926446] RIP: 0010:ice_get_ringparam+0x22/0x50 [ice]
> [66303.926649] Code: 90 90 90 90 90 90 90 90 f3 0f 1e fa 0f 1f 44 00 00 48 8b 87 c0 09 00 00 c7 46 04 e0 1f 00 00 c7 46 10 e0 1f 00 00 48 8b 50 20 <48> 8b 12 0f b7 52 3a 89 56 14 48 8b 40 28 48 8b 00 0f b7 40 58 48
> [66303.926722] RSP: 0018:ffffad40472f39c8 EFLAGS: 00010246
> [66303.926749] RAX: ffff98a8ada05828 RBX: ffff98a8c46dd060 RCX: ffffad40472f3b48
> [66303.926781] RDX: 0000000000000000 RSI: ffff98a8c46dd068 RDI: ffff98a8b23c4000
> [66303.926811] RBP: ffffad40472f3b48 R08: 00000000000337b0 R09: 0000000000000000
> [66303.926843] R10: 0000000000000001 R11: 0000000000000100 R12: ffff98a8b23c4000
> [66303.926874] R13: ffff98a8c46dd060 R14: 000000000000000f R15: ffffad40472f3a50
> [66303.926906] FS: 00007f6397966740(0000) GS:ffff98b390900000(0000) knlGS:0000000000000000
> [66303.926941] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [66303.926967] CR2: 0000000000000000 CR3: 000000011ac20002 CR4: 00000000007706e0
> [66303.926999] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> [66303.927029] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> [66303.927060] PKRU: 55555554
> [66303.927075] Call Trace:
> [66303.927094] <TASK>
> [66303.927111] ? __die+0x23/0x70
> [66303.927140] ? page_fault_oops+0x171/0x4e0
> [66303.927176] ? exc_page_fault+0x7f/0x180
> [66303.927209] ? asm_exc_page_fault+0x26/0x30
> [66303.927244] ? ice_get_ringparam+0x22/0x50 [ice]
> [66303.927433] rings_prepare_data+0x62/0x80
> [66303.927469] ethnl_default_doit+0xe2/0x350
> [66303.927501] genl_family_rcv_msg_doit.isra.0+0xe3/0x140
> [66303.927538] genl_rcv_msg+0x1b1/0x2c0
> [66303.927561] ? __pfx_ethnl_default_doit+0x10/0x10
> [66303.927590] ? __pfx_genl_rcv_msg+0x10/0x10
> [66303.927615] netlink_rcv_skb+0x58/0x110
> [66303.927644] genl_rcv+0x28/0x40
> [66303.927665] netlink_unicast+0x19e/0x290
> [66303.927691] netlink_sendmsg+0x254/0x4d0
> [66303.927717] sock_sendmsg+0x93/0xa0
> [66303.927743] __sys_sendto+0x126/0x170
> [66303.927780] __x64_sys_sendto+0x24/0x30
> [66303.928593] do_syscall_64+0x5d/0x90
> [66303.929370] ? __count_memcg_events+0x60/0xa0
> [66303.930146] ? count_memcg_events.constprop.0+0x1a/0x30
> [66303.930920] ? handle_mm_fault+0x9e/0x350
> [66303.931688] ? do_user_addr_fault+0x258/0x740
> [66303.932452] ? exc_page_fault+0x7f/0x180
> [66303.933193] entry_SYSCALL_64_after_hwframe+0x72/0xdc
>
> Fixes: 5b246e533d01 ("ice: split probe into smaller functions")
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <simon.horman@corigine.com>
To: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
piotr.raczynski@intel.com, aleksander.lobakin@intel.com,
pmenzel@molgen.mpg.de,
Przemek Kitszel <przemyslaw.kitszel@intel.com>
Subject: Re: [PATCH iwl-net v3] ice: prevent NULL pointer deref during reload
Date: Tue, 11 Jul 2023 17:33:13 +0100 [thread overview]
Message-ID: <ZK2ESQIcppzGDa80@corigine.com> (raw)
In-Reply-To: <20230706062551.2261312-1-michal.swiatkowski@linux.intel.com>
On Thu, Jul 06, 2023 at 08:25:51AM +0200, Michal Swiatkowski wrote:
> Calling ethtool during reload can lead to call trace, because VSI isn't
> configured for some time, but netdev is alive.
>
> To fix it add rtnl lock for VSI deconfig and config. Set ::num_q_vectors
> to 0 after freeing and add a check for ::tx/rx_rings in ring related
> ethtool ops.
>
> Add proper unroll of filters in ice_start_eth().
>
> Reproduction:
> $watch -n 0.1 -d 'ethtool -g enp24s0f0np0'
> $devlink dev reload pci/0000:18:00.0 action driver_reinit
>
> Call trace before fix:
> [66303.926205] BUG: kernel NULL pointer dereference, address: 0000000000000000
> [66303.926259] #PF: supervisor read access in kernel mode
> [66303.926286] #PF: error_code(0x0000) - not-present page
> [66303.926311] PGD 0 P4D 0
> [66303.926332] Oops: 0000 [#1] PREEMPT SMP PTI
> [66303.926358] CPU: 4 PID: 933821 Comm: ethtool Kdump: loaded Tainted: G OE 6.4.0-rc5+ #1
> [66303.926400] Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.00.01.0014.070920180847 07/09/2018
> [66303.926446] RIP: 0010:ice_get_ringparam+0x22/0x50 [ice]
> [66303.926649] Code: 90 90 90 90 90 90 90 90 f3 0f 1e fa 0f 1f 44 00 00 48 8b 87 c0 09 00 00 c7 46 04 e0 1f 00 00 c7 46 10 e0 1f 00 00 48 8b 50 20 <48> 8b 12 0f b7 52 3a 89 56 14 48 8b 40 28 48 8b 00 0f b7 40 58 48
> [66303.926722] RSP: 0018:ffffad40472f39c8 EFLAGS: 00010246
> [66303.926749] RAX: ffff98a8ada05828 RBX: ffff98a8c46dd060 RCX: ffffad40472f3b48
> [66303.926781] RDX: 0000000000000000 RSI: ffff98a8c46dd068 RDI: ffff98a8b23c4000
> [66303.926811] RBP: ffffad40472f3b48 R08: 00000000000337b0 R09: 0000000000000000
> [66303.926843] R10: 0000000000000001 R11: 0000000000000100 R12: ffff98a8b23c4000
> [66303.926874] R13: ffff98a8c46dd060 R14: 000000000000000f R15: ffffad40472f3a50
> [66303.926906] FS: 00007f6397966740(0000) GS:ffff98b390900000(0000) knlGS:0000000000000000
> [66303.926941] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [66303.926967] CR2: 0000000000000000 CR3: 000000011ac20002 CR4: 00000000007706e0
> [66303.926999] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> [66303.927029] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> [66303.927060] PKRU: 55555554
> [66303.927075] Call Trace:
> [66303.927094] <TASK>
> [66303.927111] ? __die+0x23/0x70
> [66303.927140] ? page_fault_oops+0x171/0x4e0
> [66303.927176] ? exc_page_fault+0x7f/0x180
> [66303.927209] ? asm_exc_page_fault+0x26/0x30
> [66303.927244] ? ice_get_ringparam+0x22/0x50 [ice]
> [66303.927433] rings_prepare_data+0x62/0x80
> [66303.927469] ethnl_default_doit+0xe2/0x350
> [66303.927501] genl_family_rcv_msg_doit.isra.0+0xe3/0x140
> [66303.927538] genl_rcv_msg+0x1b1/0x2c0
> [66303.927561] ? __pfx_ethnl_default_doit+0x10/0x10
> [66303.927590] ? __pfx_genl_rcv_msg+0x10/0x10
> [66303.927615] netlink_rcv_skb+0x58/0x110
> [66303.927644] genl_rcv+0x28/0x40
> [66303.927665] netlink_unicast+0x19e/0x290
> [66303.927691] netlink_sendmsg+0x254/0x4d0
> [66303.927717] sock_sendmsg+0x93/0xa0
> [66303.927743] __sys_sendto+0x126/0x170
> [66303.927780] __x64_sys_sendto+0x24/0x30
> [66303.928593] do_syscall_64+0x5d/0x90
> [66303.929370] ? __count_memcg_events+0x60/0xa0
> [66303.930146] ? count_memcg_events.constprop.0+0x1a/0x30
> [66303.930920] ? handle_mm_fault+0x9e/0x350
> [66303.931688] ? do_user_addr_fault+0x258/0x740
> [66303.932452] ? exc_page_fault+0x7f/0x180
> [66303.933193] entry_SYSCALL_64_after_hwframe+0x72/0xdc
>
> Fixes: 5b246e533d01 ("ice: split probe into smaller functions")
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
next prev parent reply other threads:[~2023-07-11 16:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-06 6:25 [Intel-wired-lan] [PATCH iwl-net v3] ice: prevent NULL pointer deref during reload Michal Swiatkowski
2023-07-06 6:25 ` Michal Swiatkowski
2023-07-11 16:33 ` Simon Horman [this message]
2023-07-11 16:33 ` Simon Horman
2023-07-14 9:06 ` [Intel-wired-lan] " Pucha, HimasekharX Reddy
2023-07-14 9:06 ` Pucha, HimasekharX Reddy
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=ZK2ESQIcppzGDa80@corigine.com \
--to=simon.horman@corigine.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pmenzel@molgen.mpg.de \
--cc=przemyslaw.kitszel@intel.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 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.