1
0
Fork 0
alistair23-linux/drivers/net/ethernet/broadcom
Davide Caratti c8b1d74360 bnxt_en: fix NULL dereference in case SR-IOV configuration fails
we need to set 'active_vfs' back to 0, if something goes wrong during the
allocation of SR-IOV resources: otherwise, further VF configurations will
wrongly assume that bp->pf.vf[x] are valid memory locations, and commands
like the ones in the following sequence:

 # echo 2 >/sys/bus/pci/devices/${ADDR}/sriov_numvfs
 # ip link set dev ens1f0np0 up
 # ip link set dev ens1f0np0 vf 0 trust on

will cause a kernel crash similar to this:

 bnxt_en 0000:3b:00.0: not enough MMIO resources for SR-IOV
 BUG: kernel NULL pointer dereference, address: 0000000000000014
 #PF: supervisor read access in kernel mode
 #PF: error_code(0x0000) - not-present page
 PGD 0 P4D 0
 Oops: 0000 [#1] SMP PTI
 CPU: 43 PID: 2059 Comm: ip Tainted: G          I       5.8.0-rc2.upstream+ #871
 Hardware name: Dell Inc. PowerEdge R740/08D89F, BIOS 2.2.11 06/13/2019
 RIP: 0010:bnxt_set_vf_trust+0x5b/0x110 [bnxt_en]
 Code: 44 24 58 31 c0 e8 f5 fb ff ff 85 c0 0f 85 b6 00 00 00 48 8d 1c 5b 41 89 c6 b9 0b 00 00 00 48 c1 e3 04 49 03 9c 24 f0 0e 00 00 <8b> 43 14 89 c2 83 c8 10 83 e2 ef 45 84 ed 49 89 e5 0f 44 c2 4c 89
 RSP: 0018:ffffac6246a1f570 EFLAGS: 00010246
 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 000000000000000b
 RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff98b28f538900
 RBP: ffff98b28f538900 R08: 0000000000000000 R09: 0000000000000008
 R10: ffffffffb9515be0 R11: ffffac6246a1f678 R12: ffff98b28f538000
 R13: 0000000000000001 R14: 0000000000000000 R15: ffffffffc05451e0
 FS:  00007fde0f688800(0000) GS:ffff98baffd40000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 0000000000000014 CR3: 000000104bb0a003 CR4: 00000000007606e0
 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
 PKRU: 55555554
 Call Trace:
  do_setlink+0x994/0xfe0
  __rtnl_newlink+0x544/0x8d0
  rtnl_newlink+0x47/0x70
  rtnetlink_rcv_msg+0x29f/0x350
  netlink_rcv_skb+0x4a/0x110
  netlink_unicast+0x21d/0x300
  netlink_sendmsg+0x329/0x450
  sock_sendmsg+0x5b/0x60
  ____sys_sendmsg+0x204/0x280
  ___sys_sendmsg+0x88/0xd0
  __sys_sendmsg+0x5e/0xa0
  do_syscall_64+0x47/0x80
  entry_SYSCALL_64_after_hwframe+0x44/0xa9

Fixes: c0c050c58d ("bnxt_en: New Broadcom ethernet driver.")
Reported-by: Fei Liu <feliu@redhat.com>
CC: Jonathan Toppins <jtoppins@redhat.com>
CC: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Acked-by: Jonathan Toppins <jtoppins@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-10 14:20:03 -07:00
..
bnx2x bnx2x: allow bnx2x_bsc_read() to schedule 2020-05-25 17:52:48 -07:00
bnxt bnxt_en: fix NULL dereference in case SR-IOV configuration fails 2020-07-10 14:20:03 -07:00
genet net: bcmgenet: use hardware padding of runt frames 2020-06-24 21:51:03 -07:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
b44.c net/broadcom: Clean broadcom code from driver versions 2020-03-03 17:54:53 -08:00
b44.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bcm63xx_enet.c bcm63xx_enet: remove redundant variable definitions 2020-03-05 14:59:22 -08:00
bcm63xx_enet.h bcm63xx_enet: use platform device id directly for miibus name 2017-12-19 11:07:16 -05:00
bcmsysport.c net: systemport: suppress warnings on failed Rx SKB allocations 2020-04-24 16:50:01 -07:00
bcmsysport.h Generic DIM 2019-06-27 12:42:51 -07:00
bgmac-bcma-mdio.c
bgmac-bcma.c net: ethernet: support of_get_mac_address new ERR_PTR error 2019-05-07 12:22:47 -07:00
bgmac-platform.c net: broadcom: fix a mistake about ioremap resource 2020-05-05 11:11:12 -07:00
bgmac.c bgmac: configure MTU and add support for frames beyond 8192 byte size 2020-03-27 16:07:24 -07:00
bgmac.h bgmac: configure MTU and add support for frames beyond 8192 byte size 2020-03-27 16:07:24 -07:00
bnx2.c net: bnx2: reject unsupported coalescing params 2020-03-10 16:28:53 -07:00
bnx2.h
bnx2_fw.h
cnic.c cnic: remove redundant assignment to variable ret 2020-05-08 22:46:16 -07:00
cnic.h
cnic_defs.h net: cnic: fix spelling mistake "reserverd" -> "reserved" 2020-02-17 21:59:16 -08:00
cnic_if.h
sb1250-mac.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-01-28 16:02:33 -08:00
tg3.c tg3: driver sleeps indefinitely when EEH errors exceed eeh_max_freezes 2020-06-18 20:35:04 -07:00
tg3.h broadcom: tg3: fix use of SPEED_UNKNOWN ethtool constant 2019-04-08 16:30:43 -07:00