| e4f349bd | 08-May-2025 |
Andrew Jeffery <[email protected]> |
net: mctp: Ensure keys maintain only one ref to corresponding dev
mctp_flow_prepare_output() is called in mctp_route_output(), which places outbound packets onto a given interface. The packet may re
net: mctp: Ensure keys maintain only one ref to corresponding dev
mctp_flow_prepare_output() is called in mctp_route_output(), which places outbound packets onto a given interface. The packet may represent a message fragment, in which case we provoke an unbalanced reference count to the underlying device. This causes trouble if we ever attempt to remove the interface:
[ 48.702195] usb 1-1: USB disconnect, device number 2 [ 58.883056] unregister_netdevice: waiting for mctpusb0 to become free. Usage count = 2 [ 69.022548] unregister_netdevice: waiting for mctpusb0 to become free. Usage count = 2 [ 79.172568] unregister_netdevice: waiting for mctpusb0 to become free. Usage count = 2 ...
Predicate the invocation of mctp_dev_set_key() in mctp_flow_prepare_output() on not already having associated the device with the key. It's not yet realistic to uphold the property that the key maintains only one device reference earlier in the transmission sequence as the route (and therefore the device) may not be known at the time the key is associated with the socket.
Fixes: 67737c457281 ("mctp: Pass flow data & flow release events to drivers") Acked-by: Jeremy Kerr <[email protected]> Signed-off-by: Andrew Jeffery <[email protected]> Link: https://patch.msgid.link/20250508-mctp-dev-refcount-v1-1-d4f965c67bb5@codeconstruct.com.au Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|
| 109a5331 | 19-Feb-2024 |
Jeremy Kerr <[email protected]> |
net: mctp: tests: Test that outgoing skbs have flow data populated
When CONFIG_MCTP_FLOWS is enabled, outgoing skbs should have their SKB_EXT_MCTP extension set for drivers to consume.
Add two test
net: mctp: tests: Test that outgoing skbs have flow data populated
When CONFIG_MCTP_FLOWS is enabled, outgoing skbs should have their SKB_EXT_MCTP extension set for drivers to consume.
Add two tests for local-to-output routing that check for the flow extensions: one for the simple single-packet case, and one for fragmentation.
We now make MCTP_TEST select MCTP_FLOWS, so we always get coverage of these flow tests. The tests are skippable if MCTP_FLOWS is (otherwise) disabled, but that would need manual config tweaking.
Signed-off-by: Jeremy Kerr <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
show more ...
|
| 1394c1de | 19-Feb-2024 |
Jeremy Kerr <[email protected]> |
net: mctp: copy skb ext data when fragmenting
If we're fragmenting on local output, the original packet may contain ext data for the MCTP flows. We'll want this in the resulting fragment skbs too.
net: mctp: copy skb ext data when fragmenting
If we're fragmenting on local output, the original packet may contain ext data for the MCTP flows. We'll want this in the resulting fragment skbs too.
So, do a skb_ext_copy() in the fragmentation path, and implement the MCTP-specific parts of an ext copy operation.
Fixes: 67737c457281 ("mctp: Pass flow data & flow release events to drivers") Reported-by: Jian Zhang <[email protected]> Signed-off-by: Jeremy Kerr <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
show more ...
|
| 61b50531 | 19-Feb-2024 |
Jeremy Kerr <[email protected]> |
net: mctp: tests: Add netid argument to __mctp_route_test_init
We'll want to create net-specific test setups in an upcoming change, so allow the caller to provide a non-default netid.
Signed-off-by
net: mctp: tests: Add netid argument to __mctp_route_test_init
We'll want to create net-specific test setups in an upcoming change, so allow the caller to provide a non-default netid.
Signed-off-by: Jeremy Kerr <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
show more ...
|
| c16d2380 | 19-Feb-2024 |
Jeremy Kerr <[email protected]> |
net: mctp: provide a more specific tag allocation ioctl
Now that we have net-specific tags, extend the tag allocation ioctls (SIOCMCTPALLOCTAG / SIOCMCTPDROPTAG) to allow a network parameter to be p
net: mctp: provide a more specific tag allocation ioctl
Now that we have net-specific tags, extend the tag allocation ioctls (SIOCMCTPALLOCTAG / SIOCMCTPDROPTAG) to allow a network parameter to be passed to the tag allocation.
We also add a local_addr member to the ioc struct, to allow for a future finer-grained tag allocation using local EIDs too. We don't add any specific support for that now though, so require MCTP_ADDR_ANY or MCTP_ADDR_NULL for those at present.
The old ioctls will still work, but allocate for the default MCTP net. These are now marked as deprecated in the header.
Signed-off-by: Jeremy Kerr <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
show more ...
|
| 43e67955 | 19-Feb-2024 |
Jeremy Kerr <[email protected]> |
net: mctp: separate key correlation across nets
Currently, we lookup sk_keys from the entire struct net_namespace, which may contain multiple MCTP net IDs. In those cases we want to distinguish betw
net: mctp: separate key correlation across nets
Currently, we lookup sk_keys from the entire struct net_namespace, which may contain multiple MCTP net IDs. In those cases we want to distinguish between endpoints with the same EID but different net ID.
Add the net ID data to the struct mctp_sk_key, populate on add and filter on this during route lookup.
For the ioctl interface, we use a default net of MCTP_INITIAL_DEFAULT_NET (ie., what will be in use for single-net configurations), but we'll extend the ioctl interface to provide net-specific tag allocation in an upcoming change.
Signed-off-by: Jeremy Kerr <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
show more ...
|
| a1f4cf57 | 19-Feb-2024 |
Jeremy Kerr <[email protected]> |
net: mctp: tests: create test skbs with the correct net and device
In our test skb creation functions, we're not setting up the net and device data. This doesn't matter at the moment, but we will wa
net: mctp: tests: create test skbs with the correct net and device
In our test skb creation functions, we're not setting up the net and device data. This doesn't matter at the moment, but we will want to add support for distinct net IDs in future.
Set the ->net identifier on the test MCTP device, and ensure that test skbs are set up with the correct device-related data on creation. Create a helper for setting skb->dev and mctp_skb_cb->net.
We have a few cases where we're calling __mctp_cb() to initialise the cb (which we need for the above) separately, so integrate this into the skb creation helpers.
Signed-off-by: Jeremy Kerr <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
show more ...
|
| fc944ecc | 19-Feb-2024 |
Jeremy Kerr <[email protected]> |
net: mctp: make key lookups match the ANY address on either local or peer
We may have an ANY address in either the local or peer address of a sk_key, and may want to match on an incoming daddr or sa
net: mctp: make key lookups match the ANY address on either local or peer
We may have an ANY address in either the local or peer address of a sk_key, and may want to match on an incoming daddr or saddr being ANY.
Do this by altering the conflicting-tag lookup to also accept ANY as the local/peer address.
We don't want mctp_address_matches to match on the requested EID being ANY, as that is a specific lookup case on packet input.
Reported-by: Eric Chuang <[email protected]> Reported-by: Anthony <[email protected]> Signed-off-by: Jeremy Kerr <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
show more ...
|