[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230210191606.29b8db03@kernel.org>
Date: Fri, 10 Feb 2023 19:16:06 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Tung Quang Nguyen <tung.q.nguyen@...tech.com.au>
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
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 = {};
Powered by blists - more mailing lists