* possible rose recvmsg behavior change after msg_namelen fixes
@ 2013-12-20 16:02 Florian Westphal
2013-12-20 18:11 ` Hannes Frederic Sowa
0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2013-12-20 16:02 UTC (permalink / raw)
To: hannes; +Cc: netdev, linux-hams
Hi.
recvmsg handler in net/rose/af_rose.c performs size-check
on ->msg_namelen:
if (msg->msg_namelen >= sizeof(struct full_sockaddr_rose)) {
/* something */
} else {
/* else */
}
Now that msg_namelen is zeroed before the handler calls we always
hit the 'else' branch.
TBH i don't comprehend how this was/is supposed to work.
Could someone who is familiar with AF_ROSE look at this, before
I send untested patch that blindly chops off code?
Thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: possible rose recvmsg behavior change after msg_namelen fixes
2013-12-20 16:02 possible rose recvmsg behavior change after msg_namelen fixes Florian Westphal
@ 2013-12-20 18:11 ` Hannes Frederic Sowa
0 siblings, 0 replies; 2+ messages in thread
From: Hannes Frederic Sowa @ 2013-12-20 18:11 UTC (permalink / raw)
To: Florian Westphal; +Cc: netdev, linux-hams
On Fri, Dec 20, 2013 at 05:02:07PM +0100, Florian Westphal wrote:
> Hi.
>
> recvmsg handler in net/rose/af_rose.c performs size-check
> on ->msg_namelen:
>
> if (msg->msg_namelen >= sizeof(struct full_sockaddr_rose)) {
> /* something */
> } else {
> /* else */
> }
>
> Now that msg_namelen is zeroed before the handler calls we always
> hit the 'else' branch.
>
> TBH i don't comprehend how this was/is supposed to work.
>
> Could someone who is familiar with AF_ROSE look at this, before
> I send untested patch that blindly chops off code?
Good catch, thanks!
If in doubt I would just replace msg->msg_namelen with sizeof(struct
sockaddr_storage) and do manual constant folding. ;)
I still have some patches in this area (somehow validating msg_namelen before
calling down to recvmsg, so that we don't dequeue a skb if the msg_name logic
would error out when writing the result back to user space).
The patch is still a mess but maybe we can pass the actual user-supplied
msg_namelen down then, eventually.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-20 18:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-20 16:02 possible rose recvmsg behavior change after msg_namelen fixes Florian Westphal
2013-12-20 18:11 ` Hannes Frederic Sowa
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).