From patchwork Thu Aug 20 09:21:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 265723 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AFA4C433E1 for ; Thu, 20 Aug 2020 10:13:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29972206DA for ; Thu, 20 Aug 2020 10:13:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597918400; bh=sXv/aQZI69SbI3dJ4/o3rzShpDxVRN+9/EDX6451GTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xOJGg7DZl8aXKzx9TvwAM+2TIFxL210OUtxrp+6PdyFWrGPZO/Fx3rD2Zp4VHD1fu uy+10bMFiOgs/bJfljA81HZFEk/pWM1u5EJ8yfAA+IxTzhc6JQPcfxQI9KtT+MqRcx i6ixr7V14oHh0b6Jo6EfuCK+WmDnAwOT1VPqkeL4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731117AbgHTKNR (ORCPT ); Thu, 20 Aug 2020 06:13:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:57032 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731114AbgHTKNP (ORCPT ); Thu, 20 Aug 2020 06:13:15 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 416032067C; Thu, 20 Aug 2020 10:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597918394; bh=sXv/aQZI69SbI3dJ4/o3rzShpDxVRN+9/EDX6451GTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZYHwrvtdYJqsviTigq/UarLNdnpQjyrRI6jBJ4KO8SGVhcyr9k+jYZXX/cFzdElbN K/Gu7dqlvlCZrx44Xbb/XuJpduiFi9nJc4hw4f0C7J9q4CYn0Pqt+v7C6dKgUbvuVX sY3TPA+EQJPqrj8CzAMXHk9fR/ADmnJ3pC1QMcCE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julian Wiedmann , Alexandra Winter , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 124/228] s390/qeth: dont process empty bridge port events Date: Thu, 20 Aug 2020 11:21:39 +0200 Message-Id: <20200820091613.792461704@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091607.532711107@linuxfoundation.org> References: <20200820091607.532711107@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Julian Wiedmann [ Upstream commit 02472e28b9a45471c6d8729ff2c7422baa9be46a ] Discard events that don't contain any entries. This shouldn't happen, but subsequent code relies on being able to use entry 0. So better be safe than accessing garbage. Fixes: b4d72c08b358 ("qeth: bridgeport support - basic control") Signed-off-by: Julian Wiedmann Reviewed-by: Alexandra Winter Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/s390/net/qeth_l2_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 6fa07c2469150..ae310d5ced105 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c @@ -1559,6 +1559,10 @@ static void qeth_bridge_state_change(struct qeth_card *card, int extrasize; QETH_CARD_TEXT(card, 2, "brstchng"); + if (qports->num_entries == 0) { + QETH_CARD_TEXT(card, 2, "BPempty"); + return; + } if (qports->entry_length != sizeof(struct qeth_sbp_port_entry)) { QETH_CARD_TEXT_(card, 2, "BPsz%04x", qports->entry_length); return;