aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorDongxiao Xu <dongxiao.xu@intel.com>2009-05-31 02:43:46 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-06-19 14:00:55 -0400
commit58b25a63a18e88052c8f5f068e68feaac4c6831d (patch)
tree2bbc1f6b704fd76d3a3f5abe47dd71f6bf6bf44f /drivers/staging
parent72abd2288318a35fbf225b93a31d4623e3b8c872 (diff)
Staging: heci: fix softirq safe to unsafe spinlock issue
When spinlock is nested, and the outside one is spin_lock_bh, the inner spinlock should also be spin_lock_bh, otherwise it will bring softirq-safe to softirq-unsafe lock conversion. Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/heci/heci_main.c24
-rw-r--r--drivers/staging/heci/interrupt.c8
-rw-r--r--drivers/staging/heci/io_heci.c20
3 files changed, 26 insertions, 26 deletions
diff --git a/drivers/staging/heci/heci_main.c b/drivers/staging/heci/heci_main.c
index fb97428b457c..4b02641aaa9b 100644
--- a/drivers/staging/heci/heci_main.c
+++ b/drivers/staging/heci/heci_main.c
@@ -955,10 +955,10 @@ static ssize_t heci_read(struct file *file, char __user *ubuf,
955 } 955 }
956 956
957 err = heci_start_read(dev, if_num, file_ext); 957 err = heci_start_read(dev, if_num, file_ext);
958 spin_lock(&file_ext->read_io_lock); 958 spin_lock_bh(&file_ext->read_io_lock);
959 if (err != 0 && err != -EBUSY) { 959 if (err != 0 && err != -EBUSY) {
960 DBG("heci start read failure with status = %d\n", err); 960 DBG("heci start read failure with status = %d\n", err);
961 spin_unlock(&file_ext->read_io_lock); 961 spin_unlock_bh(&file_ext->read_io_lock);
962 rets = err; 962 rets = err;
963 goto out; 963 goto out;
964 } 964 }
@@ -966,10 +966,10 @@ static ssize_t heci_read(struct file *file, char __user *ubuf,
966 && !waitqueue_active(&file_ext->rx_wait)) { 966 && !waitqueue_active(&file_ext->rx_wait)) {
967 if (file->f_flags & O_NONBLOCK) { 967 if (file->f_flags & O_NONBLOCK) {
968 rets = -EAGAIN; 968 rets = -EAGAIN;
969 spin_unlock(&file_ext->read_io_lock); 969 spin_unlock_bh(&file_ext->read_io_lock);
970 goto out; 970 goto out;
971 } 971 }
972 spin_unlock(&file_ext->read_io_lock); 972 spin_unlock_bh(&file_ext->read_io_lock);
973 973
974 if (wait_event_interruptible(file_ext->rx_wait, 974 if (wait_event_interruptible(file_ext->rx_wait,
975 (HECI_READ_COMPLETE == file_ext->reading_state 975 (HECI_READ_COMPLETE == file_ext->reading_state
@@ -989,20 +989,20 @@ static ssize_t heci_read(struct file *file, char __user *ubuf,
989 rets = -EBUSY; 989 rets = -EBUSY;
990 goto out; 990 goto out;
991 } 991 }
992 spin_lock(&file_ext->read_io_lock); 992 spin_lock_bh(&file_ext->read_io_lock);
993 } 993 }
994 994
995 priv_cb = file_ext->read_cb; 995 priv_cb = file_ext->read_cb;
996 996
997 if (!priv_cb) { 997 if (!priv_cb) {
998 spin_unlock(&file_ext->read_io_lock); 998 spin_unlock_bh(&file_ext->read_io_lock);
999 return -ENODEV; 999 return -ENODEV;
1000 } 1000 }
1001 if (file_ext->reading_state != HECI_READ_COMPLETE) { 1001 if (file_ext->reading_state != HECI_READ_COMPLETE) {
1002 spin_unlock(&file_ext->read_io_lock); 1002 spin_unlock_bh(&file_ext->read_io_lock);
1003 return 0; 1003 return 0;
1004 } 1004 }
1005 spin_unlock(&file_ext->read_io_lock); 1005 spin_unlock_bh(&file_ext->read_io_lock);
1006 /* now copy the data to user space */ 1006 /* now copy the data to user space */
1007copy_buffer: 1007copy_buffer:
1008 DBG("priv_cb->response_buffer size - %d\n", 1008 DBG("priv_cb->response_buffer size - %d\n",
@@ -1040,11 +1040,11 @@ free:
1040 list_del(&priv_cb_pos->cb_list); 1040 list_del(&priv_cb_pos->cb_list);
1041 spin_unlock_bh(&dev->device_lock); 1041 spin_unlock_bh(&dev->device_lock);
1042 heci_free_cb_private(priv_cb); 1042 heci_free_cb_private(priv_cb);
1043 spin_lock(&file_ext->read_io_lock); 1043 spin_lock_bh(&file_ext->read_io_lock);
1044 file_ext->reading_state = HECI_IDLE; 1044 file_ext->reading_state = HECI_IDLE;
1045 file_ext->read_cb = NULL; 1045 file_ext->read_cb = NULL;
1046 file_ext->read_pending = 0; 1046 file_ext->read_pending = 0;
1047 spin_unlock(&file_ext->read_io_lock); 1047 spin_unlock_bh(&file_ext->read_io_lock);
1048out: DBG("end heci read rets= %d\n", rets); 1048out: DBG("end heci read rets= %d\n", rets);
1049 return rets; 1049 return rets;
1050} 1050}
@@ -1106,11 +1106,11 @@ static ssize_t heci_write(struct file *file, const char __user *ubuf,
1106 list_del(&priv_write_cb->cb_list); 1106 list_del(&priv_write_cb->cb_list);
1107 heci_free_cb_private(priv_write_cb); 1107 heci_free_cb_private(priv_write_cb);
1108 priv_write_cb = NULL; 1108 priv_write_cb = NULL;
1109 spin_lock(&file_ext->read_io_lock); 1109 spin_lock_bh(&file_ext->read_io_lock);
1110 file_ext->reading_state = HECI_IDLE; 1110 file_ext->reading_state = HECI_IDLE;
1111 file_ext->read_cb = NULL; 1111 file_ext->read_cb = NULL;
1112 file_ext->read_pending = 0; 1112 file_ext->read_pending = 0;
1113 spin_unlock(&file_ext->read_io_lock); 1113 spin_unlock_bh(&file_ext->read_io_lock);
1114 } 1114 }
1115 } else if (file_ext->reading_state == HECI_IDLE && 1115 } else if (file_ext->reading_state == HECI_IDLE &&
1116 file_ext->read_pending == 0) 1116 file_ext->read_pending == 0)
diff --git a/drivers/staging/heci/interrupt.c b/drivers/staging/heci/interrupt.c
index aacd26243988..2db1851d1688 100644
--- a/drivers/staging/heci/interrupt.c
+++ b/drivers/staging/heci/interrupt.c
@@ -622,7 +622,7 @@ static int heci_bh_read_client_message(struct io_heci_list *complete_list,
622 priv_cb_pos->file_private; 622 priv_cb_pos->file_private;
623 if ((file_ext != NULL) && 623 if ((file_ext != NULL) &&
624 (_heci_bh_state_ok(file_ext, heci_hdr))) { 624 (_heci_bh_state_ok(file_ext, heci_hdr))) {
625 spin_lock(&file_ext->read_io_lock); 625 spin_lock_bh(&file_ext->read_io_lock);
626 file_ext->reading_state = HECI_READING; 626 file_ext->reading_state = HECI_READING;
627 buffer = (unsigned char *) 627 buffer = (unsigned char *)
628 (priv_cb_pos->response_buffer.data + 628 (priv_cb_pos->response_buffer.data +
@@ -636,7 +636,7 @@ static int heci_bh_read_client_message(struct io_heci_list *complete_list,
636 priv_cb_pos->information) { 636 priv_cb_pos->information) {
637 DBG("message overflow.\n"); 637 DBG("message overflow.\n");
638 list_del(&priv_cb_pos->cb_list); 638 list_del(&priv_cb_pos->cb_list);
639 spin_unlock(&file_ext->read_io_lock); 639 spin_unlock_bh(&file_ext->read_io_lock);
640 return -ENOMEM; 640 return -ENOMEM;
641 } 641 }
642 if (buffer) { 642 if (buffer) {
@@ -647,7 +647,7 @@ static int heci_bh_read_client_message(struct io_heci_list *complete_list,
647 if (heci_hdr->msg_complete) { 647 if (heci_hdr->msg_complete) {
648 file_ext->status = 0; 648 file_ext->status = 0;
649 list_del(&priv_cb_pos->cb_list); 649 list_del(&priv_cb_pos->cb_list);
650 spin_unlock(&file_ext->read_io_lock); 650 spin_unlock_bh(&file_ext->read_io_lock);
651 DBG("completed read host client = %d," 651 DBG("completed read host client = %d,"
652 "ME client = %d, " 652 "ME client = %d, "
653 "data length = %lu\n", 653 "data length = %lu\n",
@@ -662,7 +662,7 @@ static int heci_bh_read_client_message(struct io_heci_list *complete_list,
662 list_add_tail(&priv_cb_pos->cb_list, 662 list_add_tail(&priv_cb_pos->cb_list,
663 &complete_list->heci_cb.cb_list); 663 &complete_list->heci_cb.cb_list);
664 } else { 664 } else {
665 spin_unlock(&file_ext->read_io_lock); 665 spin_unlock_bh(&file_ext->read_io_lock);
666 } 666 }
667 667
668 break; 668 break;
diff --git a/drivers/staging/heci/io_heci.c b/drivers/staging/heci/io_heci.c
index 16c723566f6e..0d7f31bed566 100644
--- a/drivers/staging/heci/io_heci.c
+++ b/drivers/staging/heci/io_heci.c
@@ -648,26 +648,26 @@ int heci_start_read(struct iamt_heci_device *dev, int if_num,
648 } 648 }
649 spin_unlock_bh(&dev->device_lock); 649 spin_unlock_bh(&dev->device_lock);
650 DBG("check if read is pending.\n"); 650 DBG("check if read is pending.\n");
651 spin_lock(&file_ext->read_io_lock); 651 spin_lock_bh(&file_ext->read_io_lock);
652 if ((file_ext->read_pending) || (file_ext->read_cb != NULL)) { 652 if ((file_ext->read_pending) || (file_ext->read_cb != NULL)) {
653 DBG("read is pending.\n"); 653 DBG("read is pending.\n");
654 spin_unlock(&file_ext->read_io_lock); 654 spin_unlock_bh(&file_ext->read_io_lock);
655 return -EBUSY; 655 return -EBUSY;
656 } 656 }
657 spin_unlock(&file_ext->read_io_lock); 657 spin_unlock_bh(&file_ext->read_io_lock);
658 658
659 priv_cb = kzalloc(sizeof(struct heci_cb_private), GFP_KERNEL); 659 priv_cb = kzalloc(sizeof(struct heci_cb_private), GFP_KERNEL);
660 if (!priv_cb) 660 if (!priv_cb)
661 return -ENOMEM; 661 return -ENOMEM;
662 662
663 spin_lock(&file_ext->read_io_lock); 663 spin_lock_bh(&file_ext->read_io_lock);
664 DBG("allocation call back success\n" 664 DBG("allocation call back success\n"
665 "host client = %d, ME client = %d\n", 665 "host client = %d, ME client = %d\n",
666 file_ext->host_client_id, file_ext->me_client_id); 666 file_ext->host_client_id, file_ext->me_client_id);
667 spin_unlock(&file_ext->read_io_lock); 667 spin_unlock_bh(&file_ext->read_io_lock);
668 668
669 spin_lock_bh(&dev->device_lock); 669 spin_lock_bh(&dev->device_lock);
670 spin_lock(&file_ext->read_io_lock); 670 spin_lock_bh(&file_ext->read_io_lock);
671 for (i = 0; i < dev->num_heci_me_clients; i++) { 671 for (i = 0; i < dev->num_heci_me_clients; i++) {
672 if (dev->me_clients[i].client_id == file_ext->me_client_id) 672 if (dev->me_clients[i].client_id == file_ext->me_client_id)
673 break; 673 break;
@@ -675,7 +675,7 @@ int heci_start_read(struct iamt_heci_device *dev, int if_num,
675 } 675 }
676 676
677 BUG_ON(dev->me_clients[i].client_id != file_ext->me_client_id); 677 BUG_ON(dev->me_clients[i].client_id != file_ext->me_client_id);
678 spin_unlock(&file_ext->read_io_lock); 678 spin_unlock_bh(&file_ext->read_io_lock);
679 if (i == dev->num_heci_me_clients) { 679 if (i == dev->num_heci_me_clients) {
680 rets = -ENODEV; 680 rets = -ENODEV;
681 goto unlock; 681 goto unlock;
@@ -695,13 +695,13 @@ int heci_start_read(struct iamt_heci_device *dev, int if_num,
695 priv_cb->information = 0; 695 priv_cb->information = 0;
696 priv_cb->file_private = (void *) file_ext; 696 priv_cb->file_private = (void *) file_ext;
697 spin_lock_bh(&dev->device_lock); 697 spin_lock_bh(&dev->device_lock);
698 spin_lock(&file_ext->read_io_lock); 698 spin_lock_bh(&file_ext->read_io_lock);
699 file_ext->read_cb = priv_cb; 699 file_ext->read_cb = priv_cb;
700 if (dev->host_buffer_is_empty) { 700 if (dev->host_buffer_is_empty) {
701 dev->host_buffer_is_empty = 0; 701 dev->host_buffer_is_empty = 0;
702 if (!heci_send_flow_control(dev, file_ext)) { 702 if (!heci_send_flow_control(dev, file_ext)) {
703 rets = -ENODEV; 703 rets = -ENODEV;
704 spin_unlock(&file_ext->read_io_lock); 704 spin_unlock_bh(&file_ext->read_io_lock);
705 goto unlock; 705 goto unlock;
706 } else { 706 } else {
707 list_add_tail(&priv_cb->cb_list, 707 list_add_tail(&priv_cb->cb_list,
@@ -711,7 +711,7 @@ int heci_start_read(struct iamt_heci_device *dev, int if_num,
711 list_add_tail(&priv_cb->cb_list, 711 list_add_tail(&priv_cb->cb_list,
712 &dev->ctrl_wr_list.heci_cb.cb_list); 712 &dev->ctrl_wr_list.heci_cb.cb_list);
713 } 713 }
714 spin_unlock(&file_ext->read_io_lock); 714 spin_unlock_bh(&file_ext->read_io_lock);
715 spin_unlock_bh(&dev->device_lock); 715 spin_unlock_bh(&dev->device_lock);
716 return rets; 716 return rets;
717unlock: 717unlock: