All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhen Chen <chenzhen126@huawei.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: syzbot <syzbot+2e3efb5eb71cb5075ba7@syzkaller.appspotmail.com>,
	<davem@davemloft.net>, <jhs@mojatatu.com>, <jiri@resnulli.us>,
	<kuba@kernel.org>, <linux-kernel@vger.kernel.org>,
	<netdev@vger.kernel.org>, <syzkaller-bugs@googlegroups.com>,
	<xiyou.wangcong@gmail.com>, <rose.chen@huawei.com>
Subject: Re: [syzbot] WARNING: ODEBUG bug in route4_destroy
Date: Wed, 15 Jun 2022 19:57:42 +0800	[thread overview]
Message-ID: <786e43b7-fe00-ffde-ed9a-f47a695c4123@huawei.com> (raw)
In-Reply-To: <20220614144602.GJ2146@kadam>



On 22/6/14 22:46, Dan Carpenter wrote:
> On Tue, Jun 14, 2022 at 10:35:44PM +0800, 'Zhen Chen' via syzkaller-bugs wrote:
>>
>> This looks like  route4_destroy is deleting the 'fold' which has been
>> freed by tcf_queue_work in route4_change. It means 'fold' is still in
>> the table.
>> I have tested this patch on syzbot and it works well, but I am not
>> sure whether it will introduce other issues...
>>
>> diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
>> index a35ab8c27866..758c21f9d628 100644
>> --- a/net/sched/cls_route.c
>> +++ b/net/sched/cls_route.c
>> @@ -526,7 +526,7 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,
>>  	rcu_assign_pointer(f->next, f1);
>>  	rcu_assign_pointer(*fp, f);
>>  
>> -	if (fold && fold->handle && f->handle != fold->handle) {
>> +	if (fold && f->handle != fold->handle) {
>                                  ^^^^^^^^^^^^
> There is still a dereference here so your patch doesn't make sense. :/
> 
> regards,
> dan carpenter

Thanks for your reply but I think the dereference may not be the point.
If fold->handle equals 0, it will not be removed from the hash table, but afterwards the old filter will be freed because it only checks the pointer 'fold' is null or not.

if (fold) {
	tcf_unbind_filter(tp, &fold->res);
	tcf_exts_get_net(&fold->exts);
	tcf_queue_work(&fold->rwork, route4_delete_filter_work);
}

So my patch simply eliminates the handle judgement and it seems to work fine on syzbot.
If I misunderstood anything, pleaese let me know :)   Thanks!

  reply	other threads:[~2022-06-15 11:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-04 16:46 [syzbot] WARNING: ODEBUG bug in route4_destroy syzbot
2022-06-14 14:35 ` Zhen Chen
2022-06-14 14:46   ` Dan Carpenter
2022-06-15 11:57     ` Zhen Chen [this message]
     [not found] <20220615104440.1997-1-hdanton@sina.com>
2022-06-15 10:55 ` syzbot
     [not found] <20220615121701.2143-1-hdanton@sina.com>
2022-06-15 12:32 ` syzbot
     [not found] <20220615140453.2269-1-hdanton@sina.com>
2022-06-15 14:27 ` syzbot
     [not found] <20220616104752.2392-1-hdanton@sina.com>
2022-06-16 10:59 ` syzbot
     [not found] <20220616112635.2462-1-hdanton@sina.com>
2022-06-16 11:42 ` syzbot
     [not found] <20220616121345.2536-1-hdanton@sina.com>
2022-06-16 12:26 ` syzbot
     [not found] <20220616123726.2597-1-hdanton@sina.com>
2022-06-16 12:56 ` syzbot
     [not found] <20220616132136.2669-1-hdanton@sina.com>
2022-06-16 16:16 ` syzbot

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=786e43b7-fe00-ffde-ed9a-f47a695c4123@huawei.com \
    --to=chenzhen126@huawei.com \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rose.chen@huawei.com \
    --cc=syzbot+2e3efb5eb71cb5075ba7@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=xiyou.wangcong@gmail.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.