From c0dc514af8e9e5f184ab0887c3fe46a048ce8b8e Mon Sep 17 00:00:00 2001 From: Hans Wippel Date: Fri, 15 Sep 2017 18:05:12 +0200 Subject: [PATCH] zdev: Fix segfault with unknown qeth attribute This patch fixes a segfault in the qeth get_layer function that occurs when an unknown attribute is used in combination with the force option. Signed-off-by: Hans Wippel Reviewed-by: Peter Oberparleiter Signed-off-by: Michael Holzheu --- zdev/src/qeth.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zdev/src/qeth.c b/zdev/src/qeth.c index 68011a54..3c436446 100644 --- a/zdev/src/qeth.c +++ b/zdev/src/qeth.c @@ -1071,7 +1071,11 @@ static exit_code_t setting_ineffective(struct setting *s, int layer2) static enum qeth_layer_type get_layer_type(struct setting *s) { - struct qeth_attrib_data *data = s->attrib->st_data; + struct qeth_attrib_data *data; + + if (!s->attrib) + return layer_any; + data = s->attrib->st_data; if (!data) return layer_any;