Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3424609pxf; Mon, 29 Mar 2021 01:41:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8RRDf8Q+Nf8XYPXWEwWJNlyq2k4yyhF4c3kMj4lf5EHPgTmhR2aa7dEFWKK8LtpE5MeLd X-Received: by 2002:a17:906:f896:: with SMTP id lg22mr26516442ejb.124.1617007273232; Mon, 29 Mar 2021 01:41:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617007273; cv=none; d=google.com; s=arc-20160816; b=Ei6w9M/2MkQ5wCQfYDZ7hFix1VpXNsoIM25ZUd6bzY06Quu/hlsfTFSwDt24F3LNcL jUKowIfYn0kMEUumHM+rh+CKX8oEKf557h6LKWefbXedbMUczjDjBqevSayfbsLDChpA X5TkB1GwT2Y66oHW8eIcXnVQhfC+lLbVXOICUXbTowjue60PFOmU3s5c2VbAMO/lVaT7 80rs6n/1++qZ9K/FxLCREN7Guq1qoou2Iv0ceED/ZeIPU/zF04FDq5O8//tLvcGyLolK Fecuyj79SQttapRltJrLnycDJwbf8Km9x+7OuVj6QOQ3DFXRpzSNQoeBd3YpsaOgKJpI nw3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gCqRhex6s7rcg2M3L1Vw6Ybgv8a9QXXAZSrHE6c8k+Q=; b=W7UnJR1BB7TJviHOZ0+OO4n+8Db4Ls0MstfWzCTIAVZFyDjnWiL1CwZz5J7ti969kv lQ/D0TFAZnDbV52UqYKdI4NGPkvf16ugjwtyFrMUlKwcwwb4OXcW3QxW7DyapxguQ1Il Dz40wLJaHl06GlYY/rLgCrBn917SAfB9GDToR3p7DpjW7s3VmLGKmlaOgUJCFF/hqxhm K05Nt2MQ6etkHAqFw6Xq8D66fuXfpg488B6G/mPxkpVPjXLb5AK07LN25YUw+J7GgB6h IkDzewrW+2Xhlw6sNU69yuvcyfehOriVrHOeDkJntNVhydwOFlaCz10X/8n8XXeeVKkr oI7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tQWCFMCr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b9si11539807ejg.509.2021.03.29.01.40.51; Mon, 29 Mar 2021 01:41:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tQWCFMCr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233742AbhC2IgQ (ORCPT + 99 others); Mon, 29 Mar 2021 04:36:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:38286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233664AbhC2IWI (ORCPT ); Mon, 29 Mar 2021 04:22:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EB48461580; Mon, 29 Mar 2021 08:21:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617006117; bh=NeTDmqExK33DDSXztD0tqyYX3UUgV9WwtedQqfkOSnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tQWCFMCr1VM8liUVr7rO+xWtbQqsZcvN2rkWlpiIaEdMBVA6460dPokz7geNpbfs6 tEL0k9xVvnPdy6yuhv9Ep8B8ZSBKaM2oQLZSsLiD2KzZ6e2IJD6OdF/BgNRkVI/asK gTcvoLPTkOpNNkFcx5ZKly6wtX7oyAcPKJbGVzNY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Hartkopp , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.10 124/221] can: isotp: isotp_setsockopt(): only allow to set low level TX flags for CAN-FD Date: Mon, 29 Mar 2021 09:57:35 +0200 Message-Id: <20210329075633.349658475@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075629.172032742@linuxfoundation.org> References: <20210329075629.172032742@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marc Kleine-Budde [ Upstream commit e4912459bd5edd493b61bc7c3a5d9b2eb17f5a89 ] CAN-FD frames have struct canfd_frame::flags, while classic CAN frames don't. This patch refuses to set TX flags (struct can_isotp_ll_options::tx_flags) on non CAN-FD isotp sockets. Fixes: e057dd3fc20f ("can: add ISO 15765-2:2016 transport protocol") Link: https://lore.kernel.org/r/20210218215434.1708249-2-mkl@pengutronix.de Cc: Oliver Hartkopp Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- net/can/isotp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/can/isotp.c b/net/can/isotp.c index 8bd565f2073e..a9b96a6e6317 100644 --- a/net/can/isotp.c +++ b/net/can/isotp.c @@ -1212,7 +1212,8 @@ static int isotp_setsockopt(struct socket *sock, int level, int optname, if (ll.mtu != CAN_MTU && ll.mtu != CANFD_MTU) return -EINVAL; - if (ll.mtu == CAN_MTU && ll.tx_dl > CAN_MAX_DLEN) + if (ll.mtu == CAN_MTU && + (ll.tx_dl > CAN_MAX_DLEN || ll.tx_flags != 0)) return -EINVAL; memcpy(&so->ll, &ll, sizeof(ll)); -- 2.30.1