netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Tung Quang Nguyen <tung.q.nguyen@dektech.com.au>
Cc: Paolo Abeni <pabeni@redhat.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@google.com" <edumazet@google.com>,
	"jmaloy@redhat.com" <jmaloy@redhat.com>,
	"ying.xue@windriver.com" <ying.xue@windriver.com>,
	"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
	"syzbot+d43608d061e8847ec9f3@syzkaller.appspotmail.com" 
	<syzbot+d43608d061e8847ec9f3@syzkaller.appspotmail.com>
Subject: Re: [PATCH v2 net 1/1] tipc: fix kernel warning when sending SYN message
Date: Fri, 10 Feb 2023 19:16:06 -0800	[thread overview]
Message-ID: <20230210191606.29b8db03@kernel.org> (raw)
In-Reply-To: <DB9PR05MB907893AE1AECD3CA1F91D40F88D99@DB9PR05MB9078.eurprd05.prod.outlook.com>

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 = {};

  reply	other threads:[~2023-02-11  3:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08  7:07 [PATCH v2 net 1/1] tipc: fix kernel warning when sending SYN message Tung Nguyen
2023-02-09 10:38 ` Paolo Abeni
2023-02-09 11:10   ` Tung Quang Nguyen
2023-02-11  3:16     ` Jakub Kicinski [this message]
2023-02-13  0:55       ` Tung Quang Nguyen

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=20230210191606.29b8db03@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jmaloy@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+d43608d061e8847ec9f3@syzkaller.appspotmail.com \
    --cc=tung.q.nguyen@dektech.com.au \
    --cc=viro@zeniv.linux.org.uk \
    --cc=ying.xue@windriver.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 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).