diff options
author | John Wang <wangzq.jn@gmail.com> | 2024-07-30 16:46:35 +0800 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-08-01 18:04:12 -0700 |
commit | 5fcf0801ef5c8adb785520f16b4a1faa8c4ac147 (patch) | |
tree | 81e307f39aa0f865c7fd1089f92895817b32b36f /net/mctp/af_mctp.c | |
parent | 5fa35bd39ce106889909444c937a10b2d3a79f08 (diff) | |
download | linux-stable-5fcf0801ef5c8adb785520f16b4a1faa8c4ac147.tar.gz linux-stable-5fcf0801ef5c8adb785520f16b4a1faa8c4ac147.tar.bz2 linux-stable-5fcf0801ef5c8adb785520f16b4a1faa8c4ac147.zip |
net: mctp: Consistent peer address handling in ioctl tag allocation
When executing ioctl to allocate tags, if the peer address is 0,
mctp_alloc_local_tag now replaces it with 0xff. However, during tag
dropping, this replacement is not performed, potentially causing the key
not to be dropped as expected.
Signed-off-by: John Wang <wangzhiqiang02@ieisystem.com>
Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au>
Link: https://patch.msgid.link/20240730084636.184140-1-wangzhiqiang02@ieisystem.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/mctp/af_mctp.c')
-rw-r--r-- | net/mctp/af_mctp.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/mctp/af_mctp.c b/net/mctp/af_mctp.c index de52a9191da0..43288b408fde 100644 --- a/net/mctp/af_mctp.c +++ b/net/mctp/af_mctp.c @@ -486,6 +486,9 @@ static int mctp_ioctl_droptag(struct mctp_sock *msk, bool tagv2, tag = ctl.tag & MCTP_TAG_MASK; rc = -EINVAL; + if (ctl.peer_addr == MCTP_ADDR_NULL) + ctl.peer_addr = MCTP_ADDR_ANY; + spin_lock_irqsave(&net->mctp.keys_lock, flags); hlist_for_each_entry_safe(key, tmp, &msk->keys, sklist) { /* we do an irqsave here, even though we know the irq state, |