Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e675c0d2 authored by Ralph Wuerthner's avatar Ralph Wuerthner Committed by Heiko Carstens
Browse files

[S390] zcrypt: Fix ap_poll_requests counter in lost requests error path.



In the unlikely event that an AP device lost requests, don't forget to
update the ap_poll_requests counter too. Same must happen in case an AP
device is removed while there are still outstanding requests.

Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarRalph Wuerthner <rwuerthn@de.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
parent c6a48264
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -505,6 +505,9 @@ static int ap_device_remove(struct device *dev)
	spin_lock_bh(&ap_device_lock);
	spin_lock_bh(&ap_device_lock);
	list_del_init(&ap_dev->list);
	list_del_init(&ap_dev->list);
	spin_unlock_bh(&ap_device_lock);
	spin_unlock_bh(&ap_device_lock);
	spin_lock_bh(&ap_dev->lock);
	atomic_sub(ap_dev->queue_count, &ap_poll_requests);
	spin_unlock_bh(&ap_dev->lock);
	return 0;
	return 0;
}
}


@@ -867,6 +870,7 @@ static int ap_poll_read(struct ap_device *ap_dev, unsigned long *flags)
	case AP_RESPONSE_NO_PENDING_REPLY:
	case AP_RESPONSE_NO_PENDING_REPLY:
		if (status.queue_empty) {
		if (status.queue_empty) {
			/* The card shouldn't forget requests but who knows. */
			/* The card shouldn't forget requests but who knows. */
			atomic_sub(ap_dev->queue_count, &ap_poll_requests);
			ap_dev->queue_count = 0;
			ap_dev->queue_count = 0;
			list_splice_init(&ap_dev->pendingq, &ap_dev->requestq);
			list_splice_init(&ap_dev->pendingq, &ap_dev->requestq);
			ap_dev->requestq_count += ap_dev->pendingq_count;
			ap_dev->requestq_count += ap_dev->pendingq_count;