[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20131120053704.GU16541@order.stressinduktion.org>
Date: Wed, 20 Nov 2013 06:37:04 +0100
From: Hannes Frederic Sowa <hannes@...essinduktion.org>
To: David Miller <davem@...emloft.net>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH RFC] net: rework recvmsg handler msg_name and msg_namelen logic
On Tue, Nov 19, 2013 at 03:40:58PM -0500, David Miller wrote:
> From: Hannes Frederic Sowa <hannes@...essinduktion.org>
> Date: Tue, 19 Nov 2013 06:27:59 +0100
>
> > This patch now always passes msg->msg_namelen as 0. recvmsg handlers must
> > set msg_namelen to the proper size <= sizeof(struct sockaddr_storage)
> > to return msg_name to the user.
> >
> > This prevents numerous uninitialized memory leaks we had in the
> > recvmsg handlers and makes it harder for new code to accidentally leak
> > uninitialized memory.
> >
> > Optimize for the case recvfrom is called with NULL as address. We don't
> > need to copy the address at all, so set it to NULL before invoking the
> > recvmsg handler. We can do so, because all the recvmsg handlers must
> > cope with the case a plain read() is called on them. read() also sets
> > msg_name to NULL.
> >
> > Also document these changes in include/linux/net.h as suggested by David
> > Miller.
> >
> > Signed-off-by: Hannes Frederic Sowa <hannes@...essinduktion.org>
>
> Looks good to me.
>
> The only other invoker of ->recvmsg is vhost.c but it sets msg_name to NULL
> and msg_namelen to 0 so should be fine.
Thanks for the review!
I had no time to look after this change today. I want to make another
round of review tomorrow and will post a final version then.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists