From: Jiri Pirko <jiri@resnulli.us>
To: Lin Ma <linma@zju.edu.cn>
Cc: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, yuehaibing@huawei.com,
larysa.zaremba@intel.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 net-next] ila: avoid genlmsg_reply when not ila_map found
Date: Wed, 22 May 2024 10:12:30 +0200 [thread overview]
Message-ID: <Zk2o7nmCfQstc7LP@nanopsycho.orion> (raw)
In-Reply-To: <20240522031537.51741-1-linma@zju.edu.cn>
Wed, May 22, 2024 at 05:15:37AM CEST, linma@zju.edu.cn wrote:
>The current ila_xlat_nl_cmd_get_mapping will call genlmsg_reply even if
>not ila_map found with user provided parameters. Then an empty netlink
>message will be sent and cause a WARNING like below.
>
>WARNING: CPU: 1 PID: 7709 at include/linux/skbuff.h:2524 __dev_queue_xmit+0x241b/0x3b60 net/core/dev.c:4171
>Modules linked in:
>Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
>RIP: 0010:skb_assert_len include/linux/skbuff.h:2524 [inline]
>RIP: 0010:__dev_queue_xmit+0x241b/0x3b60 net/core/dev.c:4171
>RSP: 0018:ffffc9000f90f228 EFLAGS: 00010282
>RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
>RDX: 0000000000040000 RSI: ffffffff816968a8 RDI: fffff52001f21e37
>RBP: ffff8881077f2d3a R08: 0000000000000005 R09: 0000000000000000
>R10: 0000000080000000 R11: 0000000000000000 R12: dffffc0000000000
>R13: 0000000000000000 R14: ffff8881077f2c90 R15: ffff8881077f2c80
>FS: 00007fb8be338700(0000) GS:ffff888135c00000(0000) knlGS:0000000000000000
>CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>CR2: 000000c00ca8a000 CR3: 0000000105e17000 CR4: 0000000000150ee0
>Call Trace:
> <TASK>
> dev_queue_xmit include/linux/netdevice.h:3008 [inline]
> __netlink_deliver_tap_skb net/netlink/af_netlink.c:307 [inline]
> __netlink_deliver_tap net/netlink/af_netlink.c:325 [inline]
> netlink_deliver_tap+0x9e4/0xc40 net/netlink/af_netlink.c:338
> __netlink_sendskb net/netlink/af_netlink.c:1263 [inline]
> netlink_sendskb net/netlink/af_netlink.c:1272 [inline]
> netlink_unicast+0x6ac/0x7f0 net/netlink/af_netlink.c:1360
> nlmsg_unicast include/net/netlink.h:1067 [inline]
> genlmsg_unicast include/net/genetlink.h:372 [inline]
> genlmsg_reply include/net/genetlink.h:382 [inline]
> ila_xlat_nl_cmd_get_mapping+0x589/0x950 net/ipv6/ila/ila_xlat.c:493
> genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:756
> genl_family_rcv_msg net/netlink/genetlink.c:833 [inline]
> genl_rcv_msg+0x441/0x780 net/netlink/genetlink.c:850
> netlink_rcv_skb+0x153/0x400 net/netlink/af_netlink.c:2540
> genl_rcv+0x24/0x40 net/netlink/genetlink.c:861
> netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
> netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345
> netlink_sendmsg+0x917/0xe10 net/netlink/af_netlink.c:1921
> sock_sendmsg_nosec net/socket.c:714 [inline]
> sock_sendmsg+0xcf/0x120 net/socket.c:734
> ____sys_sendmsg+0x6eb/0x810 net/socket.c:2482
> ___sys_sendmsg+0x110/0x1b0 net/socket.c:2536
> __sys_sendmsg+0xf3/0x1c0 net/socket.c:2565
> do_syscall_x64 arch/x86/entry/common.c:50 [inline]
> do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
> entry_SYSCALL_64_after_hwframe+0x63/0xcd
>RIP: 0033:0x7fb8bd68f359
>Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
>RSP: 002b:00007fb8be338168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
>RAX: ffffffffffffffda RBX: 00007fb8bd7bbf80 RCX: 00007fb8bd68f359
>RDX: 0000000000000000 RSI: 0000000020000100 RDI: 0000000000000005
>RBP: 00007fb8bd6da498 R08: 0000000000000000 R09: 0000000000000000
>R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
>R13: 00007ffc22fb52af R14: 00007fb8be338300 R15: 0000000000022000
>
>Do nullptr check and assign -EINVAL ret if no ila_map found.
>
>Signed-off-by: Lin Ma <linma@zju.edu.cn>
You should aim -net tree and add appropriate Fixes tag here.
>---
> net/ipv6/ila/ila_xlat.c | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/net/ipv6/ila/ila_xlat.c b/net/ipv6/ila/ila_xlat.c
>index 67e8c9440977..63b8fe1b8255 100644
>--- a/net/ipv6/ila/ila_xlat.c
>+++ b/net/ipv6/ila/ila_xlat.c
>@@ -483,6 +483,8 @@ int ila_xlat_nl_cmd_get_mapping(struct sk_buff *skb, struct genl_info *info)
> info->snd_portid,
> info->snd_seq, 0, msg,
> info->genlhdr->cmd);
>+ } else {
>+ ret = -EINVAL;
> }
>
> rcu_read_unlock();
>--
>2.34.1
>
>
next prev parent reply other threads:[~2024-05-22 8:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-22 3:15 [PATCH v1 net-next] ila: avoid genlmsg_reply when not ila_map found Lin Ma
2024-05-22 8:12 ` Jiri Pirko [this message]
2024-05-22 17:03 ` Simon Horman
2024-05-23 1:44 ` Lin Ma
2024-05-23 12:55 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zk2o7nmCfQstc7LP@nanopsycho.orion \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=larysa.zaremba@intel.com \
--cc=linma@zju.edu.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=yuehaibing@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.