diff mbox series

[net-next,v2] net: mctp: Consistent peer address handling in ioctl tag allocation

Message ID 20240730084636.184140-1-wangzhiqiang02@ieisystem.com (mailing list archive)
State Accepted
Commit 5fcf0801ef5c8adb785520f16b4a1faa8c4ac147
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v2] net: mctp: Consistent peer address handling in ioctl tag allocation | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 42 this patch: 42
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 43 this patch: 43
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 43 this patch: 43
netdev/checkpatch warning WARNING: From:/Signed-off-by: email address mismatch: 'From: John Wang <wangzq.jn@gmail.com>' != 'Signed-off-by: John Wang <wangzhiqiang02@ieisystem.com>'
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-07-31--12-00 (tests: 707)

Commit Message

John Wang July 30, 2024, 8:46 a.m. UTC
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>

---
v2:
  - Change the subject from 'net' to 'net-next'
  - remove the Change-Id tag
---
 net/mctp/af_mctp.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jakub Kicinski Aug. 1, 2024, 3:57 p.m. UTC | #1
On Tue, 30 Jul 2024 16:46:35 +0800 John Wang wrote:
> 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>

Looks sane. Jeremy? Matt?
In netdev we try to review patches within 24-48 hours.
You have willingly boarded this crazy train.. :)
Jeremy Kerr Aug. 2, 2024, 12:21 a.m. UTC | #2
Hi Jakub and John,

> On Tue, 30 Jul 2024 16:46:35 +0800 John Wang wrote:
> > 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>
> 
> Looks sane. Jeremy? Matt?

All looks good to me!

Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au>

(John had already discussed the change with us, so no surprises on my
side)

> In netdev we try to review patches within 24-48 hours.
> You have willingly boarded this crazy train.. :)

Yeah we bought express tickets to netdev town! I just saw that there
were nipa warnings on patchwork, so was waiting on a v3. If it's okay
as-is, I'm happy for a merge.

Cheers,


Jeremy
Jakub Kicinski Aug. 2, 2024, 1:05 a.m. UTC | #3
On Fri, 02 Aug 2024 08:21:46 +0800 Jeremy Kerr wrote:
> > Looks sane. Jeremy? Matt?  
> 
> All looks good to me!
> 
> Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au>

Thanks!

> (John had already discussed the change with us, so no surprises on my
> side)
> 
> > In netdev we try to review patches within 24-48 hours.
> > You have willingly boarded this crazy train.. :)  
> 
> Yeah we bought express tickets to netdev town! I just saw that there
> were nipa warnings on patchwork, so was waiting on a v3. If it's okay
> as-is, I'm happy for a merge.

It has quite a few false-positives (especially from the in-tree tools
like checkpatch and get_maintainer).
patchwork-bot+netdevbpf@kernel.org Aug. 2, 2024, 1:10 a.m. UTC | #4
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 30 Jul 2024 16:46:35 +0800 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - [net-next,v2] net: mctp: Consistent peer address handling in ioctl tag allocation
    https://git.kernel.org/netdev/net-next/c/5fcf0801ef5c

You are awesome, thank you!
diff mbox series

Patch

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,