From patchwork Wed Apr 29 10:41:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Abeni X-Patchwork-Id: 220337 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=-6.9 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS 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 7F059C83004 for ; Wed, 29 Apr 2020 10:42:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 52BB42074A for ; Wed, 29 Apr 2020 10:42:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eJqLZ0Q/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726789AbgD2Kma (ORCPT ); Wed, 29 Apr 2020 06:42:30 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:47678 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726754AbgD2Km3 (ORCPT ); Wed, 29 Apr 2020 06:42:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588156948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d/vP2Jo5EDTLBChoi/MijCaKnAqlxa7Eg4QalR+s8uE=; b=eJqLZ0Q//YjyU+wl5gTWMS4yXSBr0xm111lpsLc1Ui1B7cmC3S5rBaKXGEQHNjoiKBrBa2 Fw4fk5SylQImaKSSBZODe9VXTnOS08NK8V+yMIO9dybzYmTQeteLtSDME30w40yPdsXcri v5ZSnTF74lrTpNmwzADS/C+Bc5BCBuI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-431-CWHC_h2KOTOXror2ZK4pdQ-1; Wed, 29 Apr 2020 06:42:26 -0400 X-MC-Unique: CWHC_h2KOTOXror2ZK4pdQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4C57945F; Wed, 29 Apr 2020 10:42:25 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-45.ams2.redhat.com [10.36.114.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE08A99D6; Wed, 29 Apr 2020 10:42:22 +0000 (UTC) From: Paolo Abeni To: netdev@vger.kernel.org Cc: Eric Dumazet , Mat Martineau , Matthieu Baerts , "David S. Miller" , Jakub Kicinski , Christoph Paasch , mptcp@lists.01.org Subject: [PATCH net 3/5] mptcp: avoid a WARN on bad input. Date: Wed, 29 Apr 2020 12:41:47 +0200 Message-Id: <388f5aba3a30dfd827f95efbe40ccb6d4ad42fe1.1588156257.git.pabeni@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Syzcaller has found a way to trigger the WARN_ON_ONCE condition in check_fully_established(). The root cause is a legit fallback to TCP scenario, so replace the WARN with a plain message on a more strict condition. Fixes: f296234c98a8 ("mptcp: Add handling of incoming MP_JOIN requests") Signed-off-by: Paolo Abeni --- net/mptcp/options.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index eadbd59586e4..ecf41d52d2fc 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -703,8 +703,6 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *sk, goto fully_established; } - WARN_ON_ONCE(subflow->can_ack); - /* If the first established packet does not contain MP_CAPABLE + data * then fallback to TCP */ @@ -714,6 +712,8 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *sk, return false; } + if (unlikely(!READ_ONCE(msk->pm.server_side))) + pr_warn_once("bogus mpc option on established client sk"); subflow->fully_established = 1; subflow->remote_key = mp_opt->sndr_key; subflow->can_ack = 1;