Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp1473973rwj; Sun, 18 Dec 2022 08:53:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf4UspivvsgWQneBL9SciWnS0nWkrvB1tCZF2nxq7RwpJsEDmRyd/Q98cCSZoKt0A35eBpdY X-Received: by 2002:a17:906:3c15:b0:7c1:4d21:abb7 with SMTP id h21-20020a1709063c1500b007c14d21abb7mr29690292ejg.54.1671382433205; Sun, 18 Dec 2022 08:53:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671382433; cv=none; d=google.com; s=arc-20160816; b=03D2bVPj9YzF1jwHrU79bM8mPc/esHhg60xtzR6pAo5CUbKSW7XgcyuXkcykTb7GBO osJ9xoMNkmNl+mbfXZ5TpEwCtZaZcee6Ln1h+CRj5PWtjYvhKNuKohUiUhngvFSPAEwA wuMegNe5wW+03SCxQ9l0p7/cmGEV3ZhUpQbcTUu9BVLV4gk/Dbvw05dMH8HA0zVWgbAZ zHhhaS0YKYYD9V0w+zBxEfZ8P44/PizmsxytHlE+NXv+iFXrdXPmTe+glCaYk4IKHAWG 7rlpKSCiUzs2sf3dlJJQEGgsX45OULDCPRPh+830+CUbCjBL0hyxpcD5gJXBQhn0ELJ+ ChtQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+6TB89JnU2cUuVOnh1ewKX8jTB/GipH1WlCVuhM/P70=; b=Gydi5tVqgSnCOboPten/o1YROghdIWoI5YeH4KQpKnPraROFrIEF1xu+iOO3S7t0ES cyVZ+pcz0S/e6ZRSRMg5VuCjsfFigBRHihYMAnSLZQ7Z9BpoCU9wqevcJEfOX7qpQ8+2 1SZMU3kXSnxbIezE3q7rFPKVHqS9cQdGCXz20Nw0Dyn4NVRy8nOmqTi62OMG90YsH1X4 qN7QpbGiTB8wkveiUvjfuOAR/3pTHstER7T2/fvZjNJTwsPqqBB7JTQm9nr/my/AF7AC Yy+VsPHRBUMWDmdu61k3reHei5+z2zx7rK6CignNux227pJBYk3M/JhBUyFRR5hyL/BP hilQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r95QBPFd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp3-20020a1709071b0300b007815e9c5b80si8250182ejc.617.2022.12.18.08.53.36; Sun, 18 Dec 2022 08:53:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r95QBPFd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232330AbiLRQjp (ORCPT + 70 others); Sun, 18 Dec 2022 11:39:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232350AbiLRQi7 (ORCPT ); Sun, 18 Dec 2022 11:38:59 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23F1D1837F; Sun, 18 Dec 2022 08:13:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C68C3B80BD1; Sun, 18 Dec 2022 16:13:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17538C433F1; Sun, 18 Dec 2022 16:13:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671380018; bh=HvhBXNttaTTCxIN6/c+CJYTilJvv/u7LgQqCqzGcXGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r95QBPFdgrbnG7ueUrJSOKc8w5V2I1BF1ACmbCxIDrU+fJ/47yYfKp2pvIvlY0xwM hUre4Lxa/y5pBoRVMwFHNvMyfBcFjN3X4N6GcRIMQfHCSlfUO499EpPROpAXYTCtne KzvXTknLe6gbvhFlN7I8QTos4KSJgU5IzQdnNP8agOrf6bDfxrZ/6gNryLggcrNoKJ 4kTO7l4fKinDmyywXuUQ/ntaAVucBJ7vMJT51WGZA2u9GJ1P3rng7kbtnqM1vqVWpA PND/0pfoee7jmfTuWLeTMkq7kzNCUoBBI6anSp/63aTsTG3N8qZZoGow4fld9YPb/E dSq38C/Oe3V8Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nathan Chancellor , Kees Cook , Jakub Kicinski , Sasha Levin , t.sailer@alumni.ethz.ch, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, ndesaulniers@google.com, linux-hams@vger.kernel.org, netdev@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH AUTOSEL 5.15 13/46] hamradio: baycom_epp: Fix return type of baycom_send_packet() Date: Sun, 18 Dec 2022 11:12:11 -0500 Message-Id: <20221218161244.930785-13-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221218161244.930785-1-sashal@kernel.org> References: <20221218161244.930785-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Chancellor [ Upstream commit c5733e5b15d91ab679646ec3149e192996a27d5d ] With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed. A proposed warning in clang aims to catch these at compile time, which reveals: drivers/net/hamradio/baycom_epp.c:1119:25: error: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Werror,-Wincompatible-function-pointer-types-strict] .ndo_start_xmit = baycom_send_packet, ^~~~~~~~~~~~~~~~~~ 1 error generated. ->ndo_start_xmit() in 'struct net_device_ops' expects a return type of 'netdev_tx_t', not 'int'. Adjust the return type of baycom_send_packet() to match the prototype's to resolve the warning and CFI failure. Link: https://github.com/ClangBuiltLinux/linux/issues/1750 Signed-off-by: Nathan Chancellor Reviewed-by: Kees Cook Link: https://lore.kernel.org/r/20221102160610.1186145-1-nathan@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/hamradio/baycom_epp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c index 6b6f28d5b8d5..f9d03f7b9101 100644 --- a/drivers/net/hamradio/baycom_epp.c +++ b/drivers/net/hamradio/baycom_epp.c @@ -758,7 +758,7 @@ static void epp_bh(struct work_struct *work) * ===================== network driver interface ========================= */ -static int baycom_send_packet(struct sk_buff *skb, struct net_device *dev) +static netdev_tx_t baycom_send_packet(struct sk_buff *skb, struct net_device *dev) { struct baycom_state *bc = netdev_priv(dev); -- 2.35.1