diff options
Diffstat (limited to 'fs/ncpfs/sock.c')
-rw-r--r-- | fs/ncpfs/sock.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/fs/ncpfs/sock.c b/fs/ncpfs/sock.c index 3a1587222c8a..6390d7b91b7f 100644 --- a/fs/ncpfs/sock.c +++ b/fs/ncpfs/sock.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
11 | 12 | ||
12 | #include <linux/time.h> | 13 | #include <linux/time.h> |
13 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
@@ -231,7 +232,7 @@ static void __ncptcp_try_send(struct ncp_server *server) | |||
231 | return; | 232 | return; |
232 | 233 | ||
233 | if (result < 0) { | 234 | if (result < 0) { |
234 | printk(KERN_ERR "ncpfs: tcp: Send failed: %d\n", result); | 235 | pr_err("tcp: Send failed: %d\n", result); |
235 | __ncp_abort_request(server, rq, result); | 236 | __ncp_abort_request(server, rq, result); |
236 | return; | 237 | return; |
237 | } | 238 | } |
@@ -332,7 +333,7 @@ static int ncp_add_request(struct ncp_server *server, struct ncp_request_reply * | |||
332 | mutex_lock(&server->rcv.creq_mutex); | 333 | mutex_lock(&server->rcv.creq_mutex); |
333 | if (!ncp_conn_valid(server)) { | 334 | if (!ncp_conn_valid(server)) { |
334 | mutex_unlock(&server->rcv.creq_mutex); | 335 | mutex_unlock(&server->rcv.creq_mutex); |
335 | printk(KERN_ERR "ncpfs: tcp: Server died\n"); | 336 | pr_err("tcp: Server died\n"); |
336 | return -EIO; | 337 | return -EIO; |
337 | } | 338 | } |
338 | ncp_req_get(req); | 339 | ncp_req_get(req); |
@@ -448,7 +449,7 @@ void ncpdgram_rcv_proc(struct work_struct *work) | |||
448 | result -= 8; | 449 | result -= 8; |
449 | hdrl = sock->sk->sk_family == AF_INET ? 8 : 6; | 450 | hdrl = sock->sk->sk_family == AF_INET ? 8 : 6; |
450 | if (sign_verify_reply(server, server->rxbuf + hdrl, result - hdrl, cpu_to_le32(result), server->rxbuf + result)) { | 451 | if (sign_verify_reply(server, server->rxbuf + hdrl, result - hdrl, cpu_to_le32(result), server->rxbuf + result)) { |
451 | printk(KERN_INFO "ncpfs: Signature violation\n"); | 452 | pr_info("Signature violation\n"); |
452 | result = -EIO; | 453 | result = -EIO; |
453 | } | 454 | } |
454 | } | 455 | } |
@@ -524,7 +525,7 @@ static int do_tcp_rcv(struct ncp_server *server, void *buffer, size_t len) | |||
524 | return result; | 525 | return result; |
525 | } | 526 | } |
526 | if (result > len) { | 527 | if (result > len) { |
527 | printk(KERN_ERR "ncpfs: tcp: bug in recvmsg (%u > %Zu)\n", result, len); | 528 | pr_err("tcp: bug in recvmsg (%u > %Zu)\n", result, len); |
528 | return -EIO; | 529 | return -EIO; |
529 | } | 530 | } |
530 | return result; | 531 | return result; |
@@ -552,7 +553,7 @@ static int __ncptcp_rcv_proc(struct ncp_server *server) | |||
552 | __ncptcp_abort(server); | 553 | __ncptcp_abort(server); |
553 | } | 554 | } |
554 | if (result < 0) { | 555 | if (result < 0) { |
555 | printk(KERN_ERR "ncpfs: tcp: error in recvmsg: %d\n", result); | 556 | pr_err("tcp: error in recvmsg: %d\n", result); |
556 | } else { | 557 | } else { |
557 | DPRINTK(KERN_ERR "ncpfs: tcp: EOF\n"); | 558 | DPRINTK(KERN_ERR "ncpfs: tcp: EOF\n"); |
558 | } | 559 | } |
@@ -566,20 +567,20 @@ static int __ncptcp_rcv_proc(struct ncp_server *server) | |||
566 | switch (server->rcv.state) { | 567 | switch (server->rcv.state) { |
567 | case 0: | 568 | case 0: |
568 | if (server->rcv.buf.magic != htonl(NCP_TCP_RCVD_MAGIC)) { | 569 | if (server->rcv.buf.magic != htonl(NCP_TCP_RCVD_MAGIC)) { |
569 | printk(KERN_ERR "ncpfs: tcp: Unexpected reply type %08X\n", ntohl(server->rcv.buf.magic)); | 570 | pr_err("tcp: Unexpected reply type %08X\n", ntohl(server->rcv.buf.magic)); |
570 | __ncptcp_abort(server); | 571 | __ncptcp_abort(server); |
571 | return -EIO; | 572 | return -EIO; |
572 | } | 573 | } |
573 | datalen = ntohl(server->rcv.buf.len) & 0x0FFFFFFF; | 574 | datalen = ntohl(server->rcv.buf.len) & 0x0FFFFFFF; |
574 | if (datalen < 10) { | 575 | if (datalen < 10) { |
575 | printk(KERN_ERR "ncpfs: tcp: Unexpected reply len %d\n", datalen); | 576 | pr_err("tcp: Unexpected reply len %d\n", datalen); |
576 | __ncptcp_abort(server); | 577 | __ncptcp_abort(server); |
577 | return -EIO; | 578 | return -EIO; |
578 | } | 579 | } |
579 | #ifdef CONFIG_NCPFS_PACKET_SIGNING | 580 | #ifdef CONFIG_NCPFS_PACKET_SIGNING |
580 | if (server->sign_active) { | 581 | if (server->sign_active) { |
581 | if (datalen < 18) { | 582 | if (datalen < 18) { |
582 | printk(KERN_ERR "ncpfs: tcp: Unexpected reply len %d\n", datalen); | 583 | pr_err("tcp: Unexpected reply len %d\n", datalen); |
583 | __ncptcp_abort(server); | 584 | __ncptcp_abort(server); |
584 | return -EIO; | 585 | return -EIO; |
585 | } | 586 | } |
@@ -618,7 +619,7 @@ skipdata:; | |||
618 | goto skipdata2; | 619 | goto skipdata2; |
619 | } | 620 | } |
620 | if (datalen > req->datalen + 8) { | 621 | if (datalen > req->datalen + 8) { |
621 | printk(KERN_ERR "ncpfs: tcp: Unexpected reply len %d (expected at most %Zd)\n", datalen, req->datalen + 8); | 622 | pr_err("tcp: Unexpected reply len %d (expected at most %Zd)\n", datalen, req->datalen + 8); |
622 | server->rcv.state = 3; | 623 | server->rcv.state = 3; |
623 | goto skipdata; | 624 | goto skipdata; |
624 | } | 625 | } |
@@ -638,12 +639,12 @@ skipdata:; | |||
638 | req = server->rcv.creq; | 639 | req = server->rcv.creq; |
639 | if (req->tx_type != NCP_ALLOC_SLOT_REQUEST) { | 640 | if (req->tx_type != NCP_ALLOC_SLOT_REQUEST) { |
640 | if (((struct ncp_reply_header*)server->rxbuf)->sequence != server->sequence) { | 641 | if (((struct ncp_reply_header*)server->rxbuf)->sequence != server->sequence) { |
641 | printk(KERN_ERR "ncpfs: tcp: Bad sequence number\n"); | 642 | pr_err("tcp: Bad sequence number\n"); |
642 | __ncp_abort_request(server, req, -EIO); | 643 | __ncp_abort_request(server, req, -EIO); |
643 | return -EIO; | 644 | return -EIO; |
644 | } | 645 | } |
645 | if ((((struct ncp_reply_header*)server->rxbuf)->conn_low | (((struct ncp_reply_header*)server->rxbuf)->conn_high << 8)) != server->connection) { | 646 | if ((((struct ncp_reply_header*)server->rxbuf)->conn_low | (((struct ncp_reply_header*)server->rxbuf)->conn_high << 8)) != server->connection) { |
646 | printk(KERN_ERR "ncpfs: tcp: Connection number mismatch\n"); | 647 | pr_err("tcp: Connection number mismatch\n"); |
647 | __ncp_abort_request(server, req, -EIO); | 648 | __ncp_abort_request(server, req, -EIO); |
648 | return -EIO; | 649 | return -EIO; |
649 | } | 650 | } |
@@ -651,7 +652,7 @@ skipdata:; | |||
651 | #ifdef CONFIG_NCPFS_PACKET_SIGNING | 652 | #ifdef CONFIG_NCPFS_PACKET_SIGNING |
652 | if (server->sign_active && req->tx_type != NCP_DEALLOC_SLOT_REQUEST) { | 653 | if (server->sign_active && req->tx_type != NCP_DEALLOC_SLOT_REQUEST) { |
653 | if (sign_verify_reply(server, server->rxbuf + 6, req->datalen - 6, cpu_to_be32(req->datalen + 16), &server->rcv.buf.type)) { | 654 | if (sign_verify_reply(server, server->rxbuf + 6, req->datalen - 6, cpu_to_be32(req->datalen + 16), &server->rcv.buf.type)) { |
654 | printk(KERN_ERR "ncpfs: tcp: Signature violation\n"); | 655 | pr_err("tcp: Signature violation\n"); |
655 | __ncp_abort_request(server, req, -EIO); | 656 | __ncp_abort_request(server, req, -EIO); |
656 | return -EIO; | 657 | return -EIO; |
657 | } | 658 | } |
@@ -742,7 +743,7 @@ static int ncp_do_request(struct ncp_server *server, int size, | |||
742 | int result; | 743 | int result; |
743 | 744 | ||
744 | if (server->lock == 0) { | 745 | if (server->lock == 0) { |
745 | printk(KERN_ERR "ncpfs: Server not locked!\n"); | 746 | pr_err("Server not locked!\n"); |
746 | return -EIO; | 747 | return -EIO; |
747 | } | 748 | } |
748 | if (!ncp_conn_valid(server)) { | 749 | if (!ncp_conn_valid(server)) { |
@@ -865,14 +866,14 @@ void ncp_lock_server(struct ncp_server *server) | |||
865 | { | 866 | { |
866 | mutex_lock(&server->mutex); | 867 | mutex_lock(&server->mutex); |
867 | if (server->lock) | 868 | if (server->lock) |
868 | printk(KERN_WARNING "ncp_lock_server: was locked!\n"); | 869 | pr_warn("%s: was locked!\n", __func__); |
869 | server->lock = 1; | 870 | server->lock = 1; |
870 | } | 871 | } |
871 | 872 | ||
872 | void ncp_unlock_server(struct ncp_server *server) | 873 | void ncp_unlock_server(struct ncp_server *server) |
873 | { | 874 | { |
874 | if (!server->lock) { | 875 | if (!server->lock) { |
875 | printk(KERN_WARNING "ncp_unlock_server: was not locked!\n"); | 876 | pr_warn("%s: was not locked!\n", __func__); |
876 | return; | 877 | return; |
877 | } | 878 | } |
878 | server->lock = 0; | 879 | server->lock = 0; |