diff options
author | Florian Westphal <fw@strlen.de> | 2013-12-22 18:32:31 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-29 22:33:17 -0500 |
commit | f81152e35001e91997ec74a7b4e040e6ab0acccf (patch) | |
tree | d13e4351639f496328c86435ac698c7bc8239a1e /net/rose | |
parent | ac3d5ac277352fe6e27809286768e9f1f8aa388d (diff) |
net: rose: restore old recvmsg behavior
recvmsg handler in net/rose/af_rose.c performs size-check ->msg_namelen.
After commit f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
(net: rework recvmsg handler msg_name and msg_namelen logic), we now
always take the else branch due to namelen being initialized to 0.
Digging in netdev-vger-cvs git repo shows that msg_namelen was
initialized with a fixed-size since at least 1995, so the else branch
was never taken.
Compile tested only.
Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rose')
-rw-r--r-- | net/rose/af_rose.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 33af77246bfe..62ced6516c58 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c | |||
@@ -1253,6 +1253,7 @@ static int rose_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1253 | 1253 | ||
1254 | if (msg->msg_name) { | 1254 | if (msg->msg_name) { |
1255 | struct sockaddr_rose *srose; | 1255 | struct sockaddr_rose *srose; |
1256 | struct full_sockaddr_rose *full_srose = msg->msg_name; | ||
1256 | 1257 | ||
1257 | memset(msg->msg_name, 0, sizeof(struct full_sockaddr_rose)); | 1258 | memset(msg->msg_name, 0, sizeof(struct full_sockaddr_rose)); |
1258 | srose = msg->msg_name; | 1259 | srose = msg->msg_name; |
@@ -1260,18 +1261,9 @@ static int rose_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1260 | srose->srose_addr = rose->dest_addr; | 1261 | srose->srose_addr = rose->dest_addr; |
1261 | srose->srose_call = rose->dest_call; | 1262 | srose->srose_call = rose->dest_call; |
1262 | srose->srose_ndigis = rose->dest_ndigis; | 1263 | srose->srose_ndigis = rose->dest_ndigis; |
1263 | if (msg->msg_namelen >= sizeof(struct full_sockaddr_rose)) { | 1264 | for (n = 0 ; n < rose->dest_ndigis ; n++) |
1264 | struct full_sockaddr_rose *full_srose = (struct full_sockaddr_rose *)msg->msg_name; | 1265 | full_srose->srose_digis[n] = rose->dest_digis[n]; |
1265 | for (n = 0 ; n < rose->dest_ndigis ; n++) | 1266 | msg->msg_namelen = sizeof(struct full_sockaddr_rose); |
1266 | full_srose->srose_digis[n] = rose->dest_digis[n]; | ||
1267 | msg->msg_namelen = sizeof(struct full_sockaddr_rose); | ||
1268 | } else { | ||
1269 | if (rose->dest_ndigis >= 1) { | ||
1270 | srose->srose_ndigis = 1; | ||
1271 | srose->srose_digi = rose->dest_digis[0]; | ||
1272 | } | ||
1273 | msg->msg_namelen = sizeof(struct sockaddr_rose); | ||
1274 | } | ||
1275 | } | 1267 | } |
1276 | 1268 | ||
1277 | skb_free_datagram(sk, skb); | 1269 | skb_free_datagram(sk, skb); |