From patchwork Mon Aug 17 15:14:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 266002 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 E0539C433E1 for ; Mon, 17 Aug 2020 19:25:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB82D20674 for ; Mon, 17 Aug 2020 19:25:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597692300; bh=oqclE7P4Uix6mzOgO7GXp5zg1fACZ9N2FYFeR1/rkDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=uHcyHOJ8Kwazaxh0gLrtGA5AdS/H6cnO9emiOH3ay7O2+dGuvAKuydGBeB+1Hzsct 27ZzY/3FsB1X7VrqOJbob16Hi0OQNAGgIfCma6ctsTtGaH91wzXg8kUcFwAETYrkUB PXM2EU2zzEj+oj2hLLYEpODj8TL8+gtkqUm1dB1U= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730426AbgHQTZA (ORCPT ); Mon, 17 Aug 2020 15:25:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:39058 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730425AbgHQPeU (ORCPT ); Mon, 17 Aug 2020 11:34:20 -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 65B4420882; Mon, 17 Aug 2020 15:34:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597678459; bh=oqclE7P4Uix6mzOgO7GXp5zg1fACZ9N2FYFeR1/rkDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZhMzeQEfBBIf7nBc+jlfoUXScjIE2spZ1VQ3aFUtmLHAZgIy0PZQbwCBrTTw7FI5T Vq7HgyO8G9uD+Hmw/2OUat6rcWOxSHOoIL04IbU0f6uSbKZJhCsXalzJxLlN9HbcKZ bPy9mWX6C/8lpJLxht/brFFv6xRvcuRVe3vAxQ2M= 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 5.8 341/464] s390/qeth: dont process empty bridge port events Date: Mon, 17 Aug 2020 17:14:54 +0200 Message-Id: <20200817143850.108854688@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143833.737102804@linuxfoundation.org> References: <20200817143833.737102804@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 2d3bca3c0141f..b4e06aeb6dc1c 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c @@ -1142,6 +1142,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;