mirror of
https://github.com/torvalds/linux.git
synced 2026-11-27 00:43:12 +00:00
IB/mad: Verify mgmt class in received MADs
If a received MAD contains an invalid or reserved mgmt class, we will attempt to access method_table outside of its range. Add a check to ensure that mgmt class falls within the handled range. Found by code inspection. Signed-off-by: Sean Hefty <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
This commit is contained in:
committed by
Roland Dreier
parent
f45ee80eb0
commit
b7ab0b19a8
@@ -1596,6 +1596,9 @@ find_mad_agent(struct ib_mad_port_private *port_priv,
|
||||
mad->mad_hdr.class_version].class;
|
||||
if (!class)
|
||||
goto out;
|
||||
if (convert_mgmt_class(mad->mad_hdr.mgmt_class) >=
|
||||
IB_MGMT_MAX_METHODS)
|
||||
goto out;
|
||||
method = class->method_table[convert_mgmt_class(
|
||||
mad->mad_hdr.mgmt_class)];
|
||||
if (method)
|
||||
|
||||
Reference in New Issue
Block a user