]> git.baikalelectronics.ru Git - kernel.git/commit
cxl: Fix NULL dereference in cxl_context_init() on PowerVM guests
authorAndrew Donnellan <andrew.donnellan@au1.ibm.com>
Thu, 28 Jul 2016 05:39:41 +0000 (15:39 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 9 Aug 2016 06:52:02 +0000 (16:52 +1000)
commit49e55d908b623504d391d8ff574ceee900d08c99
tree007c1bc56c5541efe87ee836f86ec58423bc4bef
parentc83844374913505a2f4c12491457e29a474e5a69
cxl: Fix NULL dereference in cxl_context_init() on PowerVM guests

Commit 7355a8d18a6f ("cxl: Workaround PE=0 hardware limitation in
Mellanox CX4") added a "min_pe" field to struct cxl_service_layer_ops,
to allow us to work around a Mellanox CX-4 hardware limitation.

When allocating the PE number in cxl_context_init(), we read from
ctx->afu->adapter->native->sl_ops->min_pe to get the minimum PE number.
Unsurprisingly, in a PowerVM guest ctx->afu->adapter->native is NULL,
and guests don't have a cxl_service_layer_ops struct anywhere.

Move min_pe from struct cxl_service_layer_ops to struct cxl so it's
accessible in both native and PowerVM environments. For the Mellanox
CX-4, set the min_pe value in set_sl_ops().

Fixes: 7355a8d18a6f ("cxl: Workaround PE=0 hardware limitation in Mellanox CX4")
Reported-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
drivers/misc/cxl/context.c
drivers/misc/cxl/cxl.h
drivers/misc/cxl/pci.c