From: Wei Gao <wegao@suse.com>
To: kernel test robot <oliver.sang@intel.com>
Cc: Menglong Dong <menglong8.dong@gmail.com>,
kuniyu@google.com, kraig@google.com, lkp@intel.com,
netdev@vger.kernel.org, dsahern@kernel.org,
linux-kernel@vger.kernel.org, rcu@vger.kernel.org,
edumazet@google.com, horms@kernel.org, oe-lkp@lists.linux.dev,
kuba@kernel.org, pabeni@redhat.com, ncardwell@google.com,
davem@davemloft.net, ltp@lists.linux.it,
Menglong Dong <dongml2@chinatelecom.cn>
Subject: Re: [LTP] [PATCH net v2] net: ip: order the reuseport socket in __inet_hash
Date: Sat, 16 Aug 2025 02:18:21 +0000 [thread overview]
Message-ID: <aJ_qbZDvDJwVoZGA@localhost> (raw)
In-Reply-To: <202508110750.a66a4225-lkp@intel.com>
On Mon, Aug 11, 2025 at 01:27:12PM +0800, kernel test robot wrote:
>
>
> Hello,
>
> kernel test robot noticed "BUG:KASAN:slab-use-after-free_in__inet_hash" on:
>
> commit: 859ca60b71ef223e210d3d003a225d9ca70879fd ("[PATCH net v2] net: ip: order the reuseport socket in __inet_hash")
> url: https://github.com/intel-lab-lkp/linux/commits/Menglong-Dong/net-ip-order-the-reuseport-socket-in-__inet_hash/20250801-171131
> base: https://git.kernel.org/cgit/linux/kernel/git/davem/net.git 01051012887329ea78eaca19b1d2eac4c9f601b5
> patch link: https://lore.kernel.org/all/20250801090949.129941-1-dongml2@chinatelecom.cn/
> patch subject: [PATCH net v2] net: ip: order the reuseport socket in __inet_hash
>
> in testcase: ltp
> version: ltp-x86_64-6505f9e29-1_20250802
> with following parameters:
>
> disk: 1HDD
> fs: ext4
> test: fs_perms_simple
>
>
>
> config: x86_64-rhel-9.4-ltp
> compiler: gcc-12
> test machine: 4 threads 1 sockets Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz (Ivy Bridge) with 8G memory
>
> (please refer to attached dmesg/kmsg for entire log/backtrace)
>
>
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <oliver.sang@intel.com>
> | Closes: https://lore.kernel.org/oe-lkp/202508110750.a66a4225-lkp@intel.com
>
>
> kern :err : [ 128.186735] BUG: KASAN: slab-use-after-free in __inet_hash (net/ipv4/inet_hashtables.c:749 net/ipv4/inet_hashtables.c:800)
This kasan error not related with LTP case, i guess it triggered by network
related process such as bind etc. I try to give following patch to fix
kasan error, correct me if any mistake, thanks.
From: Wei Gao <wegao@suse.com>
Date: Sat, 16 Aug 2025 09:32:56 +0800
Subject: [PATCH v1] net: Fix BUG:KASAN:slab-use-after-free_in__inet_hash
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202508110750.a66a4225-lkp@intel.com
Signed-off-by: Wei Gao <wegao@suse.com>
---
include/linux/rculist_nulls.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/rculist_nulls.h b/include/linux/rculist_nulls.h
index da500f4ae142..5def9009c507 100644
--- a/include/linux/rculist_nulls.h
+++ b/include/linux/rculist_nulls.h
@@ -57,7 +57,7 @@ static inline void hlist_nulls_del_init_rcu(struct hlist_nulls_node *n)
* @node: element of the list.
*/
#define hlist_nulls_pprev_rcu(node) \
- (*((struct hlist_nulls_node __rcu __force **)&(node)->pprev))
+ (*((struct hlist_nulls_node __rcu __force **)(node)->pprev))
/**
* hlist_nulls_del_rcu - deletes entry from hash list without re-initialization
@@ -175,7 +175,7 @@ static inline void hlist_nulls_add_before_rcu(struct hlist_nulls_node *n,
{
WRITE_ONCE(n->pprev, next->pprev);
n->next = next;
- rcu_assign_pointer(hlist_nulls_pprev_rcu(n), n);
+ rcu_assign_pointer(hlist_nulls_pprev_rcu(next), n);
WRITE_ONCE(next->pprev, &n->next);
}
--
2.43.0
next prev parent reply other threads:[~2025-08-16 2:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250801090949.129941-1-dongml2@chinatelecom.cn>
2025-08-11 5:27 ` [PATCH net v2] net: ip: order the reuseport socket in __inet_hash kernel test robot
2025-08-16 2:18 ` Wei Gao [this message]
2025-08-16 2:35 ` [LTP] " Kuniyuki Iwashima
2025-08-16 7:27 ` Wei Gao
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=aJ_qbZDvDJwVoZGA@localhost \
--to=wegao@suse.com \
--cc=davem@davemloft.net \
--cc=dongml2@chinatelecom.cn \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kraig@google.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=ltp@lists.linux.it \
--cc=menglong8.dong@gmail.com \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=oe-lkp@lists.linux.dev \
--cc=oliver.sang@intel.com \
--cc=pabeni@redhat.com \
--cc=rcu@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).