]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
net: cxgb3_main: Add CAP_NET_ADMIN check to CHELSIO_GET_MEM
authorMichael Ellerman <mpe@ellerman.id.au>
Fri, 24 Jan 2020 09:41:44 +0000 (20:41 +1100)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 6 Mar 2020 07:13:20 +0000 (02:13 -0500)
commit70b76085be35135a66c760ccf49e90c7c8af5e98
tree84d4192af44d3c30b483241c7392199e0ed5c12b
parent9bf11ce77e4e93b0926e41ed1167d7632793804d
net: cxgb3_main: Add CAP_NET_ADMIN check to CHELSIO_GET_MEM

BugLink: https://bugs.launchpad.net/bugs/1864261
[ Upstream commit 3546d8f1bbe992488ed91592cf6bf76e7114791a =

The cxgb3 driver for "Chelsio T3-based gigabit and 10Gb Ethernet
adapters" implements a custom ioctl as SIOCCHIOCTL/SIOCDEVPRIVATE in
cxgb_extension_ioctl().

One of the subcommands of the ioctl is CHELSIO_GET_MEM, which appears
to read memory directly out of the adapter and return it to userspace.
It's not entirely clear what the contents of the adapter memory
contains, but the assumption is that it shouldn't be accessible to all
users.

So add a CAP_NET_ADMIN check to the CHELSIO_GET_MEM case. Put it after
the is_offload() check, which matches two of the other subcommands in
the same function which also check for is_offload() and CAP_NET_ADMIN.

Found by Ilja by code inspection, not tested as I don't have the
required hardware.

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c