diff options
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r-- | fs/cifs/connect.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index e8fa46c7cff2..b51d5777cde6 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -455,7 +455,7 @@ incomplete_rcv: | |||
455 | /* Note that FC 1001 length is big endian on the wire, | 455 | /* Note that FC 1001 length is big endian on the wire, |
456 | but we convert it here so it is always manipulated | 456 | but we convert it here so it is always manipulated |
457 | as host byte order */ | 457 | as host byte order */ |
458 | pdu_length = ntohl(smb_buffer->smb_buf_length); | 458 | pdu_length = be32_to_cpu((__force __be32)smb_buffer->smb_buf_length); |
459 | smb_buffer->smb_buf_length = pdu_length; | 459 | smb_buffer->smb_buf_length = pdu_length; |
460 | 460 | ||
461 | cFYI(1, ("rfc1002 length 0x%x", pdu_length+4)); | 461 | cFYI(1, ("rfc1002 length 0x%x", pdu_length+4)); |
@@ -1461,6 +1461,39 @@ get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, const char *old_path, | |||
1461 | return rc; | 1461 | return rc; |
1462 | } | 1462 | } |
1463 | 1463 | ||
1464 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
1465 | static struct lock_class_key cifs_key[2]; | ||
1466 | static struct lock_class_key cifs_slock_key[2]; | ||
1467 | |||
1468 | static inline void | ||
1469 | cifs_reclassify_socket4(struct socket *sock) | ||
1470 | { | ||
1471 | struct sock *sk = sock->sk; | ||
1472 | BUG_ON(sock_owned_by_user(sk)); | ||
1473 | sock_lock_init_class_and_name(sk, "slock-AF_INET-CIFS", | ||
1474 | &cifs_slock_key[0], "sk_lock-AF_INET-CIFS", &cifs_key[0]); | ||
1475 | } | ||
1476 | |||
1477 | static inline void | ||
1478 | cifs_reclassify_socket6(struct socket *sock) | ||
1479 | { | ||
1480 | struct sock *sk = sock->sk; | ||
1481 | BUG_ON(sock_owned_by_user(sk)); | ||
1482 | sock_lock_init_class_and_name(sk, "slock-AF_INET6-CIFS", | ||
1483 | &cifs_slock_key[1], "sk_lock-AF_INET6-CIFS", &cifs_key[1]); | ||
1484 | } | ||
1485 | #else | ||
1486 | static inline void | ||
1487 | cifs_reclassify_socket4(struct socket *sock) | ||
1488 | { | ||
1489 | } | ||
1490 | |||
1491 | static inline void | ||
1492 | cifs_reclassify_socket6(struct socket *sock) | ||
1493 | { | ||
1494 | } | ||
1495 | #endif | ||
1496 | |||
1464 | /* See RFC1001 section 14 on representation of Netbios names */ | 1497 | /* See RFC1001 section 14 on representation of Netbios names */ |
1465 | static void rfc1002mangle(char *target, char *source, unsigned int length) | 1498 | static void rfc1002mangle(char *target, char *source, unsigned int length) |
1466 | { | 1499 | { |
@@ -1495,6 +1528,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket, | |||
1495 | /* BB other socket options to set KEEPALIVE, NODELAY? */ | 1528 | /* BB other socket options to set KEEPALIVE, NODELAY? */ |
1496 | cFYI(1, ("Socket created")); | 1529 | cFYI(1, ("Socket created")); |
1497 | (*csocket)->sk->sk_allocation = GFP_NOFS; | 1530 | (*csocket)->sk->sk_allocation = GFP_NOFS; |
1531 | cifs_reclassify_socket4(*csocket); | ||
1498 | } | 1532 | } |
1499 | } | 1533 | } |
1500 | 1534 | ||
@@ -1627,6 +1661,7 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket) | |||
1627 | /* BB other socket options to set KEEPALIVE, NODELAY? */ | 1661 | /* BB other socket options to set KEEPALIVE, NODELAY? */ |
1628 | cFYI(1, ("ipv6 Socket created")); | 1662 | cFYI(1, ("ipv6 Socket created")); |
1629 | (*csocket)->sk->sk_allocation = GFP_NOFS; | 1663 | (*csocket)->sk->sk_allocation = GFP_NOFS; |
1664 | cifs_reclassify_socket6(*csocket); | ||
1630 | } | 1665 | } |
1631 | } | 1666 | } |
1632 | 1667 | ||