[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <DB9PR05MB907889C6756A547F4F1916F788DD9@DB9PR05MB9078.eurprd05.prod.outlook.com>
Date: Mon, 13 Feb 2023 00:55:10 +0000
From: Tung Quang Nguyen <tung.q.nguyen@...tech.com.au>
To: Jakub Kicinski <kuba@...nel.org>
CC: Paolo Abeni <pabeni@...hat.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"jmaloy@...hat.com" <jmaloy@...hat.com>,
"ying.xue@...driver.com" <ying.xue@...driver.com>,
"viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
"syzbot+d43608d061e8847ec9f3@...kaller.appspotmail.com"
<syzbot+d43608d061e8847ec9f3@...kaller.appspotmail.com>
Subject: RE: [PATCH v2 net 1/1] tipc: fix kernel warning when sending SYN
message
>-----Original Message-----
>From: Jakub Kicinski <kuba@...nel.org>
>Sent: Saturday, February 11, 2023 10:16 AM
>To: Tung Quang Nguyen <tung.q.nguyen@...tech.com.au>
>Cc: Paolo Abeni <pabeni@...hat.com>; netdev@...r.kernel.org; davem@...emloft.net; edumazet@...gle.com;
>jmaloy@...hat.com; ying.xue@...driver.com; viro@...iv.linux.org.uk; syzbot+d43608d061e8847ec9f3@...kaller.appspotmail.com
>Subject: Re: [PATCH v2 net 1/1] tipc: fix kernel warning when sending SYN message
>
>On Thu, 9 Feb 2023 11:10:16 +0000 Tung Quang Nguyen wrote:
>> >> msg_set_size(mhdr, msz);
>> >>
>> >> + if (!dsz)
>> >> + iov_iter_init(&m->msg_iter, ITER_SOURCE, NULL, 0, 0);
>> >
>> >It looks like the root cause of the problem is that not all (indirect)
>> >callers of tipc_msg_build() properly initialize the iter.
>> >
>> >tipc_connect() is one of such caller, but AFAICS even tipc_accept() can
>> >reach tipc_msg_build() without proper iter initialization - via
>> >__tipc_sendstream -> __tipc_sendmsg.
>> >
>> >I think it's better if you address the issue in relevant callers,
>> >avoiding unneeded and confusing code in tipc_msg_build().
>>
>> I am fully aware of callers (without initializing iovec) of this
>> function. My intention was to make as less change as possible.
>
>General kernel guidance is to fix things "right" (i.e. so that the fix
>doesn't have to be refactored later).
>
>> Do you think using iov_iter_kvec() instead in the callers make sense
>> if I go for what you suggested ?
>
>I think so. These are the potential culprits?
>
>$ git grep 'struct msghdr [^*]*;' -- net/tipc/
>net/tipc/socket.c: struct msghdr m = {NULL,};
>net/tipc/socket.c: struct msghdr m = {NULL,};
>net/tipc/topsrv.c: struct msghdr msg;
>net/tipc/topsrv.c: struct msghdr msg = {};
Thanks. I will send v3.
Powered by blists - more mailing lists