s390/qeth: conclude all event processing before offlining a card
Work for Bridgeport events is currently placed on a driver-wide
workqueue. If the card is removed and freed while any such work is still
active, this causes a use-after-free.
So put the events on a per-card queue, where we can control their
lifetime. As we also don't want stale events to last beyond an
offline & online cycle, flush this queue when setting the card offline.
Fixes: b4d72c08b3 ("qeth: bridgeport support - basic control")
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
c2780c1a3f
commit
c0a2e4d10d
@@ -369,6 +369,8 @@ static void qeth_l2_stop_card(struct qeth_card *card, int recovery_mode)
|
||||
qeth_clear_cmd_buffers(&card->read);
|
||||
qeth_clear_cmd_buffers(&card->write);
|
||||
}
|
||||
|
||||
flush_workqueue(card->event_wq);
|
||||
}
|
||||
|
||||
static int qeth_l2_process_inbound_buffer(struct qeth_card *card,
|
||||
@@ -1436,7 +1438,7 @@ static void qeth_bridge_state_change(struct qeth_card *card,
|
||||
data->card = card;
|
||||
memcpy(&data->qports, qports,
|
||||
sizeof(struct qeth_sbp_state_change) + extrasize);
|
||||
queue_work(qeth_wq, &data->worker);
|
||||
queue_work(card->event_wq, &data->worker);
|
||||
}
|
||||
|
||||
struct qeth_bridge_host_data {
|
||||
@@ -1508,7 +1510,7 @@ static void qeth_bridge_host_event(struct qeth_card *card,
|
||||
data->card = card;
|
||||
memcpy(&data->hostevs, hostevs,
|
||||
sizeof(struct qeth_ipacmd_addr_change) + extrasize);
|
||||
queue_work(qeth_wq, &data->worker);
|
||||
queue_work(card->event_wq, &data->worker);
|
||||
}
|
||||
|
||||
/* SETBRIDGEPORT support; sending commands */
|
||||
|
||||
Reference in New Issue
Block a user