mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 08:08:54 +00:00
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 <echuang@google.com> Reported-by: Anthony <anthonyhkf@google.com> Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
aee6479a45
commit
fc944ecc4f
1 changed files with 11 additions and 3 deletions
|
@ -113,7 +113,7 @@ static bool mctp_key_match(struct mctp_sk_key *key, mctp_eid_t local,
|
||||||
if (!mctp_address_matches(key->local_addr, local))
|
if (!mctp_address_matches(key->local_addr, local))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (key->peer_addr != peer)
|
if (!mctp_address_matches(key->peer_addr, peer))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (key->tag != tag)
|
if (key->tag != tag)
|
||||||
|
@ -672,8 +672,16 @@ struct mctp_sk_key *mctp_alloc_local_tag(struct mctp_sock *msk,
|
||||||
if (tmp->tag & MCTP_HDR_FLAG_TO)
|
if (tmp->tag & MCTP_HDR_FLAG_TO)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!(mctp_address_matches(tmp->peer_addr, peer) &&
|
/* Since we're avoiding conflicting entries, match peer and
|
||||||
mctp_address_matches(tmp->local_addr, local)))
|
* local addresses, including with a wildcard on ANY. See
|
||||||
|
* 'A note on key allocations' for background.
|
||||||
|
*/
|
||||||
|
if (peer != MCTP_ADDR_ANY &&
|
||||||
|
!mctp_address_matches(tmp->peer_addr, peer))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (local != MCTP_ADDR_ANY &&
|
||||||
|
!mctp_address_matches(tmp->local_addr, local))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
spin_lock(&tmp->lock);
|
spin_lock(&tmp->lock);
|
||||||
|
|
Loading…
Reference in a new issue