From: Kurt Van Dijck <kurt.van.dijck-/BeEPy95v10@public.gmane.org>
To: Oliver Hartkopp <socketcan-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>
Cc: socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] can: test size of struct sockaddr
Date: Sat, 15 Jan 2011 20:35:27 +0100 [thread overview]
Message-ID: <20110115193526.GB463@e-circ.dyndns.org> (raw)
In-Reply-To: <4D31D4A6.4040701-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>
On Sat, Jan 15, 2011 at 06:08:54PM +0100, Oliver Hartkopp wrote:
> On 14.01.2011 18:23, Kurt Van Dijck wrote:
> > I think this patch makes the CAN socket code comform to the
> > manpages of sendmsg & recvmsg.
>
> Hello Kurt,
>
> if you check similar code sniplets in the kernel you would see, that in
> recvmsg()-cases the given namelen is not used from userspace.
I went into udp code, but my mind got troubled there.
>
> If msg->msg_name is not NULL the msg_namelen is just set by the kernel. E.g.
> see af_packet.c, af_econet.c, etc.
I should have looked further ...
Given this, I went up to net/socket.c:__sys_recvmsg.
Within kernel space, a struct sockaddr_storage is used in fact ....
This solves indeed the problem I was trying to address.
>
> So the code in candump.c setting the msg_namelen before recvmsg() is obviously
> obsolete ...
I think no, since after the socket's recvmsg() has been called,
since move_addr_to_user() will do checks similar as I tried to reimplement.
>
> Btw. your two patches below for bcm_sendmsg() and raw_sendmesg() look good.
>
> If you would like to resubmit these two patches, you may add my Acked-by
Thanks, I will do so.
Kurt
prev parent reply other threads:[~2011-01-15 19:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-14 17:23 [PATCH] can: test size of struct sockaddr Kurt Van Dijck
[not found] ` <20110114172321.GB331-MxZ6Iy/zr/UdbCeoMzGj59i2O/JbrIOy@public.gmane.org>
2011-01-15 17:08 ` Oliver Hartkopp
[not found] ` <4D31D4A6.4040701-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>
2011-01-15 19:35 ` Kurt Van Dijck [this message]
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=20110115193526.GB463@e-circ.dyndns.org \
--to=kurt.van.dijck-/beepy95v10@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org \
--cc=socketcan-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org \
/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).