aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-10-21 11:43:05 -0400
committerDavid S. Miller <davem@davemloft.net>2010-10-21 11:43:05 -0400
commit2198a10b501fd4443430cb17e065a9e859cc58c9 (patch)
tree87f3781d293da0f8f8f61615905eb7bf62b7c128 /net
parent9941fb62762253774cc6177d0b9172ece5133fe1 (diff)
parentdb5a753bf198ef7a50e17d2ff358adf37efe8648 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: net/core/dev.c
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/l2cap.c4
-rw-r--r--net/core/dev.c2
-rw-r--r--net/rds/page.c27
-rw-r--r--net/tipc/subscr.c68
-rw-r--r--net/tipc/subscr.h2
5 files changed, 50 insertions, 53 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 16049de49896..daa7a988d9a6 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -2911,7 +2911,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd
2911 struct l2cap_chan_list *list = &conn->chan_list; 2911 struct l2cap_chan_list *list = &conn->chan_list;
2912 struct l2cap_conn_req *req = (struct l2cap_conn_req *) data; 2912 struct l2cap_conn_req *req = (struct l2cap_conn_req *) data;
2913 struct l2cap_conn_rsp rsp; 2913 struct l2cap_conn_rsp rsp;
2914 struct sock *parent, *uninitialized_var(sk); 2914 struct sock *parent, *sk = NULL;
2915 int result, status = L2CAP_CS_NO_INFO; 2915 int result, status = L2CAP_CS_NO_INFO;
2916 2916
2917 u16 dcid = 0, scid = __le16_to_cpu(req->scid); 2917 u16 dcid = 0, scid = __le16_to_cpu(req->scid);
@@ -3020,7 +3020,7 @@ sendresp:
3020 L2CAP_INFO_REQ, sizeof(info), &info); 3020 L2CAP_INFO_REQ, sizeof(info), &info);
3021 } 3021 }
3022 3022
3023 if (!(l2cap_pi(sk)->conf_state & L2CAP_CONF_REQ_SENT) && 3023 if (sk && !(l2cap_pi(sk)->conf_state & L2CAP_CONF_REQ_SENT) &&
3024 result == L2CAP_CR_SUCCESS) { 3024 result == L2CAP_CR_SUCCESS) {
3025 u8 buf[128]; 3025 u8 buf[128];
3026 l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT; 3026 l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT;
diff --git a/net/core/dev.c b/net/core/dev.c
index b2269ac04cb8..6d4218cdb739 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1484,7 +1484,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
1484 nf_reset(skb); 1484 nf_reset(skb);
1485 1485
1486 if (unlikely(!(dev->flags & IFF_UP) || 1486 if (unlikely(!(dev->flags & IFF_UP) ||
1487 (skb->len > (dev->mtu + dev->hard_header_len)))) { 1487 (skb->len > (dev->mtu + dev->hard_header_len + VLAN_HLEN)))) {
1488 atomic_long_inc(&dev->rx_dropped); 1488 atomic_long_inc(&dev->rx_dropped);
1489 kfree_skb(skb); 1489 kfree_skb(skb);
1490 return NET_RX_DROP; 1490 return NET_RX_DROP;
diff --git a/net/rds/page.c b/net/rds/page.c
index a3e2e0ac8a60..d8acdebe3c7c 100644
--- a/net/rds/page.c
+++ b/net/rds/page.c
@@ -58,30 +58,17 @@ int rds_page_copy_user(struct page *page, unsigned long offset,
58 unsigned long ret; 58 unsigned long ret;
59 void *addr; 59 void *addr;
60 60
61 if (to_user) 61 addr = kmap(page);
62 if (to_user) {
62 rds_stats_add(s_copy_to_user, bytes); 63 rds_stats_add(s_copy_to_user, bytes);
63 else 64 ret = copy_to_user(ptr, addr + offset, bytes);
65 } else {
64 rds_stats_add(s_copy_from_user, bytes); 66 rds_stats_add(s_copy_from_user, bytes);
65 67 ret = copy_from_user(addr + offset, ptr, bytes);
66 addr = kmap_atomic(page, KM_USER0);
67 if (to_user)
68 ret = __copy_to_user_inatomic(ptr, addr + offset, bytes);
69 else
70 ret = __copy_from_user_inatomic(addr + offset, ptr, bytes);
71 kunmap_atomic(addr, KM_USER0);
72
73 if (ret) {
74 addr = kmap(page);
75 if (to_user)
76 ret = copy_to_user(ptr, addr + offset, bytes);
77 else
78 ret = copy_from_user(addr + offset, ptr, bytes);
79 kunmap(page);
80 if (ret)
81 return -EFAULT;
82 } 68 }
69 kunmap(page);
83 70
84 return 0; 71 return ret ? -EFAULT : 0;
85} 72}
86EXPORT_SYMBOL_GPL(rds_page_copy_user); 73EXPORT_SYMBOL_GPL(rds_page_copy_user);
87 74
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index 18813acc6bef..33313961d010 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -76,6 +76,19 @@ struct top_srv {
76static struct top_srv topsrv = { 0 }; 76static struct top_srv topsrv = { 0 };
77 77
78/** 78/**
79 * htohl - convert value to endianness used by destination
80 * @in: value to convert
81 * @swap: non-zero if endianness must be reversed
82 *
83 * Returns converted value
84 */
85
86static u32 htohl(u32 in, int swap)
87{
88 return swap ? swab32(in) : in;
89}
90
91/**
79 * subscr_send_event - send a message containing a tipc_event to the subscriber 92 * subscr_send_event - send a message containing a tipc_event to the subscriber
80 * 93 *
81 * Note: Must not hold subscriber's server port lock, since tipc_send() will 94 * Note: Must not hold subscriber's server port lock, since tipc_send() will
@@ -94,11 +107,11 @@ static void subscr_send_event(struct subscription *sub,
94 msg_sect.iov_base = (void *)&sub->evt; 107 msg_sect.iov_base = (void *)&sub->evt;
95 msg_sect.iov_len = sizeof(struct tipc_event); 108 msg_sect.iov_len = sizeof(struct tipc_event);
96 109
97 sub->evt.event = htonl(event); 110 sub->evt.event = htohl(event, sub->swap);
98 sub->evt.found_lower = htonl(found_lower); 111 sub->evt.found_lower = htohl(found_lower, sub->swap);
99 sub->evt.found_upper = htonl(found_upper); 112 sub->evt.found_upper = htohl(found_upper, sub->swap);
100 sub->evt.port.ref = htonl(port_ref); 113 sub->evt.port.ref = htohl(port_ref, sub->swap);
101 sub->evt.port.node = htonl(node); 114 sub->evt.port.node = htohl(node, sub->swap);
102 tipc_send(sub->server_ref, 1, &msg_sect); 115 tipc_send(sub->server_ref, 1, &msg_sect);
103} 116}
104 117
@@ -274,29 +287,16 @@ static void subscr_cancel(struct tipc_subscr *s,
274{ 287{
275 struct subscription *sub; 288 struct subscription *sub;
276 struct subscription *sub_temp; 289 struct subscription *sub_temp;
277 __u32 type, lower, upper, timeout, filter;
278 int found = 0; 290 int found = 0;
279 291
280 /* Find first matching subscription, exit if not found */ 292 /* Find first matching subscription, exit if not found */
281 293
282 type = ntohl(s->seq.type);
283 lower = ntohl(s->seq.lower);
284 upper = ntohl(s->seq.upper);
285 timeout = ntohl(s->timeout);
286 filter = ntohl(s->filter) & ~TIPC_SUB_CANCEL;
287
288 list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list, 294 list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list,
289 subscription_list) { 295 subscription_list) {
290 if ((type == sub->seq.type) && 296 if (!memcmp(s, &sub->evt.s, sizeof(struct tipc_subscr))) {
291 (lower == sub->seq.lower) && 297 found = 1;
292 (upper == sub->seq.upper) && 298 break;
293 (timeout == sub->timeout) && 299 }
294 (filter == sub->filter) &&
295 !memcmp(s->usr_handle,sub->evt.s.usr_handle,
296 sizeof(s->usr_handle)) ){
297 found = 1;
298 break;
299 }
300 } 300 }
301 if (!found) 301 if (!found)
302 return; 302 return;
@@ -310,7 +310,7 @@ static void subscr_cancel(struct tipc_subscr *s,
310 k_term_timer(&sub->timer); 310 k_term_timer(&sub->timer);
311 spin_lock_bh(subscriber->lock); 311 spin_lock_bh(subscriber->lock);
312 } 312 }
313 dbg("Cancel: removing sub %u,%u,%u from subscriber %p list\n", 313 dbg("Cancel: removing sub %u,%u,%u from subscriber %x list\n",
314 sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber); 314 sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber);
315 subscr_del(sub); 315 subscr_del(sub);
316} 316}
@@ -325,10 +325,16 @@ static struct subscription *subscr_subscribe(struct tipc_subscr *s,
325 struct subscriber *subscriber) 325 struct subscriber *subscriber)
326{ 326{
327 struct subscription *sub; 327 struct subscription *sub;
328 int swap;
329
330 /* Determine subscriber's endianness */
331
332 swap = !(s->filter & (TIPC_SUB_PORTS | TIPC_SUB_SERVICE));
328 333
329 /* Detect & process a subscription cancellation request */ 334 /* Detect & process a subscription cancellation request */
330 335
331 if (ntohl(s->filter) & TIPC_SUB_CANCEL) { 336 if (s->filter & htohl(TIPC_SUB_CANCEL, swap)) {
337 s->filter &= ~htohl(TIPC_SUB_CANCEL, swap);
332 subscr_cancel(s, subscriber); 338 subscr_cancel(s, subscriber);
333 return NULL; 339 return NULL;
334 } 340 }
@@ -353,12 +359,13 @@ static struct subscription *subscr_subscribe(struct tipc_subscr *s,
353 359
354 /* Initialize subscription object */ 360 /* Initialize subscription object */
355 361
356 sub->seq.type = ntohl(s->seq.type); 362 sub->seq.type = htohl(s->seq.type, swap);
357 sub->seq.lower = ntohl(s->seq.lower); 363 sub->seq.lower = htohl(s->seq.lower, swap);
358 sub->seq.upper = ntohl(s->seq.upper); 364 sub->seq.upper = htohl(s->seq.upper, swap);
359 sub->timeout = ntohl(s->timeout); 365 sub->timeout = htohl(s->timeout, swap);
360 sub->filter = ntohl(s->filter); 366 sub->filter = htohl(s->filter, swap);
361 if ((sub->filter && (sub->filter != TIPC_SUB_PORTS)) || 367 if ((!(sub->filter & TIPC_SUB_PORTS) ==
368 !(sub->filter & TIPC_SUB_SERVICE)) ||
362 (sub->seq.lower > sub->seq.upper)) { 369 (sub->seq.lower > sub->seq.upper)) {
363 warn("Subscription rejected, illegal request\n"); 370 warn("Subscription rejected, illegal request\n");
364 kfree(sub); 371 kfree(sub);
@@ -369,6 +376,7 @@ static struct subscription *subscr_subscribe(struct tipc_subscr *s,
369 INIT_LIST_HEAD(&sub->nameseq_list); 376 INIT_LIST_HEAD(&sub->nameseq_list);
370 list_add(&sub->subscription_list, &subscriber->subscription_list); 377 list_add(&sub->subscription_list, &subscriber->subscription_list);
371 sub->server_ref = subscriber->port_ref; 378 sub->server_ref = subscriber->port_ref;
379 sub->swap = swap;
372 memcpy(&sub->evt.s, s, sizeof(struct tipc_subscr)); 380 memcpy(&sub->evt.s, s, sizeof(struct tipc_subscr));
373 atomic_inc(&topsrv.subscription_count); 381 atomic_inc(&topsrv.subscription_count);
374 if (sub->timeout != TIPC_WAIT_FOREVER) { 382 if (sub->timeout != TIPC_WAIT_FOREVER) {
diff --git a/net/tipc/subscr.h b/net/tipc/subscr.h
index c20f496d95b2..45d89bf4d202 100644
--- a/net/tipc/subscr.h
+++ b/net/tipc/subscr.h
@@ -53,6 +53,7 @@ typedef void (*tipc_subscr_event) (struct subscription *sub,
53 * @nameseq_list: adjacent subscriptions in name sequence's subscription list 53 * @nameseq_list: adjacent subscriptions in name sequence's subscription list
54 * @subscription_list: adjacent subscriptions in subscriber's subscription list 54 * @subscription_list: adjacent subscriptions in subscriber's subscription list
55 * @server_ref: object reference of server port associated with subscription 55 * @server_ref: object reference of server port associated with subscription
56 * @swap: indicates if subscriber uses opposite endianness in its messages
56 * @evt: template for events generated by subscription 57 * @evt: template for events generated by subscription
57 */ 58 */
58 59
@@ -65,6 +66,7 @@ struct subscription {
65 struct list_head nameseq_list; 66 struct list_head nameseq_list;
66 struct list_head subscription_list; 67 struct list_head subscription_list;
67 u32 server_ref; 68 u32 server_ref;
69 int swap;
68 struct tipc_event evt; 70 struct tipc_event evt;
69}; 71};
70 72