Re: [PATCH] net: cxgb3_main: Add CAP_NET_ADMIN check to CHELSIO_GET_MEM

From: David Miller
Date: Sat Jan 25 2020 - 04:56:35 EST


From: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
Date: Fri, 24 Jan 2020 20:41:44 +1100

> 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@xxxxxxxxxxxx>
> Signed-off-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx>

Applied and queued up for -stable.