[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1543008.1670434984@warthog.procyon.org.uk>
Date: Wed, 07 Dec 2022 17:43:04 +0000
From: David Howells <dhowells@...hat.com>
To: syzbot <syzbot+3538a6a72efa8b059c38@...kaller.appspotmail.com>
Cc: dhowells@...hat.com, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, linux-afs@...ts.infradead.org,
linux-kernel@...r.kernel.org, marc.dionne@...istor.com,
netdev@...r.kernel.org, pabeni@...hat.com,
syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] KASAN: use-after-free Read in rxrpc_lookup_local
#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git master
diff --git a/kernel/kthread.c b/kernel/kthread.c
index f97fd01a2932..1335c89c6225 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -336,7 +336,6 @@ static int kthread(void *_create)
void *data = create->data;
struct completion *done;
struct kthread *self;
- int ret;
self = to_kthread(current);
@@ -365,17 +364,20 @@ static int kthread(void *_create)
* or the creator may spend more time in wait_task_inactive().
*/
preempt_disable();
+ if (test_bit(KTHREAD_SHOULD_STOP, &self->flags)) {
+ preempt_enable();
+ create->result = ERR_PTR(-EINTR);
+ complete(done);
+ do_exit(0);
+ }
complete(done);
schedule_preempt_disabled();
preempt_enable();
- ret = -EINTR;
- if (!test_bit(KTHREAD_SHOULD_STOP, &self->flags)) {
- cgroup_kthread_ready();
- __kthread_parkme(self);
- ret = threadfn(data);
- }
- kthread_exit(ret);
+ cgroup_kthread_ready();
+ __kthread_parkme(self);
+ /* Run the actual thread function. */
+ kthread_exit(threadfn(data));
}
/* called from kernel_clone() to get node information for about to be created task */
diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c
index 44222923c0d1..24ee585d9aaf 100644
--- a/net/rxrpc/local_object.c
+++ b/net/rxrpc/local_object.c
@@ -357,10 +357,11 @@ struct rxrpc_local *rxrpc_use_local(struct rxrpc_local *local,
*/
void rxrpc_unuse_local(struct rxrpc_local *local, enum rxrpc_local_trace why)
{
- unsigned int debug_id = local->debug_id;
+ unsigned int debug_id;
int r, u;
if (local) {
+ debug_id = local->debug_id;
r = refcount_read(&local->ref);
u = atomic_dec_return(&local->active_users);
trace_rxrpc_local(debug_id, why, r, u);
Powered by blists - more mailing lists