Skip to content

Commit a20ee51

Browse files
committed
Merge branch 's390-fixes'
Julian Wiedmann says: ==================== s390/qeth: fixes 2019-11-20 please apply two late qeth fixes to your net tree. The first fixes a deadlock that can occur if a qeth device is set offline while in the middle of processing deferred HW events. The second patch converts the return value of an error path to use -EIO, so that it can be passed back to userspace. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 004b394 + 2f3c269 commit a20ee51

File tree

4 files changed

+33
-13
lines changed

4 files changed

+33
-13
lines changed

drivers/s390/net/qeth_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,7 @@ struct qeth_card {
839839
struct service_level qeth_service_level;
840840
struct qdio_ssqd_desc ssqd;
841841
debug_info_t *debug;
842+
struct mutex sbp_lock;
842843
struct mutex conf_mutex;
843844
struct mutex discipline_mutex;
844845
struct napi_struct napi;

drivers/s390/net/qeth_core_main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -901,30 +901,30 @@ static int qeth_get_problem(struct qeth_card *card, struct ccw_device *cdev,
901901
CCW_DEVID(cdev), dstat, cstat);
902902
print_hex_dump(KERN_WARNING, "qeth: irb ", DUMP_PREFIX_OFFSET,
903903
16, 1, irb, 64, 1);
904-
return 1;
904+
return -EIO;
905905
}
906906

907907
if (dstat & DEV_STAT_UNIT_CHECK) {
908908
if (sense[SENSE_RESETTING_EVENT_BYTE] &
909909
SENSE_RESETTING_EVENT_FLAG) {
910910
QETH_CARD_TEXT(card, 2, "REVIND");
911-
return 1;
911+
return -EIO;
912912
}
913913
if (sense[SENSE_COMMAND_REJECT_BYTE] &
914914
SENSE_COMMAND_REJECT_FLAG) {
915915
QETH_CARD_TEXT(card, 2, "CMDREJi");
916-
return 1;
916+
return -EIO;
917917
}
918918
if ((sense[2] == 0xaf) && (sense[3] == 0xfe)) {
919919
QETH_CARD_TEXT(card, 2, "AFFE");
920-
return 1;
920+
return -EIO;
921921
}
922922
if ((!sense[0]) && (!sense[1]) && (!sense[2]) && (!sense[3])) {
923923
QETH_CARD_TEXT(card, 2, "ZEROSEN");
924924
return 0;
925925
}
926926
QETH_CARD_TEXT(card, 2, "DGENCHK");
927-
return 1;
927+
return -EIO;
928928
}
929929
return 0;
930930
}

drivers/s390/net/qeth_l2_main.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -467,10 +467,14 @@ static void qeth_l2_set_promisc_mode(struct qeth_card *card)
467467
if (card->info.promisc_mode == enable)
468468
return;
469469

470-
if (qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE))
470+
if (qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE)) {
471471
qeth_setadp_promisc_mode(card, enable);
472-
else if (card->options.sbp.reflect_promisc)
473-
qeth_l2_promisc_to_bridge(card, enable);
472+
} else {
473+
mutex_lock(&card->sbp_lock);
474+
if (card->options.sbp.reflect_promisc)
475+
qeth_l2_promisc_to_bridge(card, enable);
476+
mutex_unlock(&card->sbp_lock);
477+
}
474478
}
475479

476480
/* New MAC address is added to the hash table and marked to be written on card
@@ -631,6 +635,7 @@ static int qeth_l2_probe_device(struct ccwgroup_device *gdev)
631635
int rc;
632636

633637
qeth_l2_vnicc_set_defaults(card);
638+
mutex_init(&card->sbp_lock);
634639

635640
if (gdev->dev.type == &qeth_generic_devtype) {
636641
rc = qeth_l2_create_device_attributes(&gdev->dev);
@@ -804,10 +809,12 @@ static int qeth_l2_set_online(struct ccwgroup_device *gdev)
804809
} else
805810
card->info.hwtrap = 0;
806811

812+
mutex_lock(&card->sbp_lock);
807813
qeth_bridgeport_query_support(card);
808814
if (card->options.sbp.supported_funcs)
809815
dev_info(&card->gdev->dev,
810816
"The device represents a Bridge Capable Port\n");
817+
mutex_unlock(&card->sbp_lock);
811818

812819
qeth_l2_register_dev_addr(card);
813820

@@ -1162,9 +1169,9 @@ static void qeth_bridge_state_change_worker(struct work_struct *work)
11621169

11631170
/* Role should not change by itself, but if it did, */
11641171
/* information from the hardware is authoritative. */
1165-
mutex_lock(&data->card->conf_mutex);
1172+
mutex_lock(&data->card->sbp_lock);
11661173
data->card->options.sbp.role = entry->role;
1167-
mutex_unlock(&data->card->conf_mutex);
1174+
mutex_unlock(&data->card->sbp_lock);
11681175

11691176
snprintf(env_locrem, sizeof(env_locrem), "BRIDGEPORT=statechange");
11701177
snprintf(env_role, sizeof(env_role), "ROLE=%s",
@@ -1230,9 +1237,9 @@ static void qeth_bridge_host_event_worker(struct work_struct *work)
12301237
: (data->hostevs.lost_event_mask == 0x02)
12311238
? "Bridge port state change"
12321239
: "Unknown reason");
1233-
mutex_lock(&data->card->conf_mutex);
1240+
mutex_lock(&data->card->sbp_lock);
12341241
data->card->options.sbp.hostnotification = 0;
1235-
mutex_unlock(&data->card->conf_mutex);
1242+
mutex_unlock(&data->card->sbp_lock);
12361243
qeth_bridge_emit_host_event(data->card, anev_abort,
12371244
0, NULL, NULL);
12381245
} else

drivers/s390/net/qeth_l2_sys.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ static ssize_t qeth_bridge_port_role_state_show(struct device *dev,
2424
if (qeth_l2_vnicc_is_in_use(card))
2525
return sprintf(buf, "n/a (VNIC characteristics)\n");
2626

27+
mutex_lock(&card->sbp_lock);
2728
if (qeth_card_hw_is_reachable(card) &&
2829
card->options.sbp.supported_funcs)
2930
rc = qeth_bridgeport_query_ports(card,
@@ -57,6 +58,7 @@ static ssize_t qeth_bridge_port_role_state_show(struct device *dev,
5758
else
5859
rc = sprintf(buf, "%s\n", word);
5960
}
61+
mutex_unlock(&card->sbp_lock);
6062

6163
return rc;
6264
}
@@ -91,6 +93,7 @@ static ssize_t qeth_bridge_port_role_store(struct device *dev,
9193
return -EINVAL;
9294

9395
mutex_lock(&card->conf_mutex);
96+
mutex_lock(&card->sbp_lock);
9497

9598
if (qeth_l2_vnicc_is_in_use(card))
9699
rc = -EBUSY;
@@ -104,6 +107,7 @@ static ssize_t qeth_bridge_port_role_store(struct device *dev,
104107
} else
105108
card->options.sbp.role = role;
106109

110+
mutex_unlock(&card->sbp_lock);
107111
mutex_unlock(&card->conf_mutex);
108112

109113
return rc ? rc : count;
@@ -158,6 +162,7 @@ static ssize_t qeth_bridgeport_hostnotification_store(struct device *dev,
158162
return rc;
159163

160164
mutex_lock(&card->conf_mutex);
165+
mutex_lock(&card->sbp_lock);
161166

162167
if (qeth_l2_vnicc_is_in_use(card))
163168
rc = -EBUSY;
@@ -168,6 +173,7 @@ static ssize_t qeth_bridgeport_hostnotification_store(struct device *dev,
168173
} else
169174
card->options.sbp.hostnotification = enable;
170175

176+
mutex_unlock(&card->sbp_lock);
171177
mutex_unlock(&card->conf_mutex);
172178

173179
return rc ? rc : count;
@@ -223,6 +229,7 @@ static ssize_t qeth_bridgeport_reflect_store(struct device *dev,
223229
return -EINVAL;
224230

225231
mutex_lock(&card->conf_mutex);
232+
mutex_lock(&card->sbp_lock);
226233

227234
if (qeth_l2_vnicc_is_in_use(card))
228235
rc = -EBUSY;
@@ -234,6 +241,7 @@ static ssize_t qeth_bridgeport_reflect_store(struct device *dev,
234241
rc = 0;
235242
}
236243

244+
mutex_unlock(&card->sbp_lock);
237245
mutex_unlock(&card->conf_mutex);
238246

239247
return rc ? rc : count;
@@ -269,6 +277,8 @@ void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card)
269277
return;
270278
if (!card->options.sbp.supported_funcs)
271279
return;
280+
281+
mutex_lock(&card->sbp_lock);
272282
if (card->options.sbp.role != QETH_SBP_ROLE_NONE) {
273283
/* Conditional to avoid spurious error messages */
274284
qeth_bridgeport_setrole(card, card->options.sbp.role);
@@ -280,8 +290,10 @@ void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card)
280290
rc = qeth_bridgeport_an_set(card, 1);
281291
if (rc)
282292
card->options.sbp.hostnotification = 0;
283-
} else
293+
} else {
284294
qeth_bridgeport_an_set(card, 0);
295+
}
296+
mutex_unlock(&card->sbp_lock);
285297
}
286298

287299
/* VNIC CHARS support */

0 commit comments

Comments
 (0)