Skip to content

Commit e14c779

Browse files
committed
Merge tag 's390-5.13-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 fixes from Vasily Gorbik: - Fix zcrypt ioctl hang due to AP queue msg counter dropping below 0 when pending requests are purged. - Two fixes for the machine check handler in the entry code. * tag 's390-5.13-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: s390/ap: Fix hanging ioctl caused by wrong msg counter s390/mcck: fix invalid KVM guest condition check s390/mcck: fix calculation of SIE critical section size
2 parents 9ed13a1 + e73a99f commit e14c779

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

arch/s390/kernel/entry.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,9 @@ ENDPROC(stack_overflow)
651651
.Lcleanup_sie_mcck:
652652
larl %r13,.Lsie_entry
653653
slgr %r9,%r13
654-
larl %r13,.Lsie_skip
654+
lghi %r13,.Lsie_skip - .Lsie_entry
655655
clgr %r9,%r13
656-
jh .Lcleanup_sie_int
656+
jhe .Lcleanup_sie_int
657657
oi __LC_CPU_FLAGS+7, _CIF_MCCK_GUEST
658658
.Lcleanup_sie_int:
659659
BPENTER __SF_SIE_FLAGS(%r15),(_TIF_ISOLATE_BP|_TIF_ISOLATE_BP_GUEST)

drivers/s390/crypto/ap_queue.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,13 @@ static struct ap_queue_status ap_sm_recv(struct ap_queue *aq)
135135
{
136136
struct ap_queue_status status;
137137
struct ap_message *ap_msg;
138+
bool found = false;
138139

139140
status = ap_dqap(aq->qid, &aq->reply->psmid,
140141
aq->reply->msg, aq->reply->len);
141142
switch (status.response_code) {
142143
case AP_RESPONSE_NORMAL:
143-
aq->queue_count--;
144+
aq->queue_count = max_t(int, 0, aq->queue_count - 1);
144145
if (aq->queue_count > 0)
145146
mod_timer(&aq->timeout,
146147
jiffies + aq->request_timeout);
@@ -150,8 +151,14 @@ static struct ap_queue_status ap_sm_recv(struct ap_queue *aq)
150151
list_del_init(&ap_msg->list);
151152
aq->pendingq_count--;
152153
ap_msg->receive(aq, ap_msg, aq->reply);
154+
found = true;
153155
break;
154156
}
157+
if (!found) {
158+
AP_DBF_WARN("%s unassociated reply psmid=0x%016llx on 0x%02x.%04x\n",
159+
__func__, aq->reply->psmid,
160+
AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid));
161+
}
155162
fallthrough;
156163
case AP_RESPONSE_NO_PENDING_REPLY:
157164
if (!status.queue_empty || aq->queue_count <= 0)
@@ -232,7 +239,7 @@ static enum ap_sm_wait ap_sm_write(struct ap_queue *aq)
232239
ap_msg->flags & AP_MSG_FLAG_SPECIAL);
233240
switch (status.response_code) {
234241
case AP_RESPONSE_NORMAL:
235-
aq->queue_count++;
242+
aq->queue_count = max_t(int, 1, aq->queue_count + 1);
236243
if (aq->queue_count == 1)
237244
mod_timer(&aq->timeout, jiffies + aq->request_timeout);
238245
list_move_tail(&ap_msg->list, &aq->pendingq);

0 commit comments

Comments
 (0)