diff options
Diffstat (limited to 'net/econet/af_econet.c')
-rw-r--r-- | net/econet/af_econet.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index f8c1ae4b41f0..e366f1bef91f 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c | |||
@@ -297,23 +297,14 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
297 | 297 | ||
298 | mutex_lock(&econet_mutex); | 298 | mutex_lock(&econet_mutex); |
299 | 299 | ||
300 | if (saddr == NULL) { | 300 | if (saddr == NULL || msg->msg_namelen < sizeof(struct sockaddr_ec)) { |
301 | struct econet_sock *eo = ec_sk(sk); | 301 | mutex_unlock(&econet_mutex); |
302 | 302 | return -EINVAL; | |
303 | addr.station = eo->station; | 303 | } |
304 | addr.net = eo->net; | 304 | addr.station = saddr->addr.station; |
305 | port = eo->port; | 305 | addr.net = saddr->addr.net; |
306 | cb = eo->cb; | 306 | port = saddr->port; |
307 | } else { | 307 | cb = saddr->cb; |
308 | if (msg->msg_namelen < sizeof(struct sockaddr_ec)) { | ||
309 | mutex_unlock(&econet_mutex); | ||
310 | return -EINVAL; | ||
311 | } | ||
312 | addr.station = saddr->addr.station; | ||
313 | addr.net = saddr->addr.net; | ||
314 | port = saddr->port; | ||
315 | cb = saddr->cb; | ||
316 | } | ||
317 | 308 | ||
318 | /* Look for a device with the right network number. */ | 309 | /* Look for a device with the right network number. */ |
319 | dev = net2dev_map[addr.net]; | 310 | dev = net2dev_map[addr.net]; |
@@ -351,7 +342,6 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
351 | 342 | ||
352 | eb = (struct ec_cb *)&skb->cb; | 343 | eb = (struct ec_cb *)&skb->cb; |
353 | 344 | ||
354 | /* BUG: saddr may be NULL */ | ||
355 | eb->cookie = saddr->cookie; | 345 | eb->cookie = saddr->cookie; |
356 | eb->sec = *saddr; | 346 | eb->sec = *saddr; |
357 | eb->sent = ec_tx_done; | 347 | eb->sent = ec_tx_done; |