Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp178951rwi; Wed, 12 Oct 2022 18:11:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7OsjV7Terx+8a0do9sHyK3wrLLKc96ngkAkU46icNBTvDM6xs1Xo68ptg1FOHX53jlOjqI X-Received: by 2002:a63:942:0:b0:43c:428d:16a9 with SMTP id 63-20020a630942000000b0043c428d16a9mr27084444pgj.423.1665623490657; Wed, 12 Oct 2022 18:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665623490; cv=none; d=google.com; s=arc-20160816; b=JT3dN4UCD/9AxOT/zIzfVkZuY8mx7zvLz6RrljJxFqPEt9JZSTOmeqTjCt3mOY94mM iKfx179zNiOf6jmJs3rgPOnmvqxtBIUz73bzcJVZs2acqOUXLTwDOV+cuR+I4bRk8LIE JgwMiauPr7exszZJG6y+oqc7TqvSa8AUrTObelTB2YwY4lQBm9kIeXUtQHbRuxqJvCyF OBnE9DTw6LQ5d2+BI0XGo7eHs4GRGbRZdXFV5iyxgq63lriYtXYhyMs+vK/5a3exPgQk rEDY1xlLGKKHdl7f+BfkvCY1LW04HEqo1XocCHVYYxvWJODvj+Bw1uI91zj20V5sVZkB OSyA== 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=zqpCAHn5W99mQVcKGqduo3ui0rXWNTVJPlxCHmYHbTA=; b=BDoO3yuBAteRKr8sZ2ce5rrbHaK+Av5QVeGlXAuAUOvBLeucjASxZjo+vcHME9TQuo pdyenwp1zfq5t1NLrUqkivHcP00g3A3hdUNVOEY41XN6guY5FF7k7kZw30gdGn+qVMiy +ROvyS35/KNOUxRl1OtPObdFdqNWVrZVHqkfgutVu3OVJB7NXM2ZtlIZHX59/hxSy8+4 500wEzR8QCoR2l+M0fm7g+ehXxpwlNmpAgVvvEDMERgvb9C7M5e5UKzwBZauVb2dFDP3 x0t1ezkUgmLxirBxp1yTHQGyLbi1jqG5uaV60IsMt8skwo4Yor2jb6FtI5q9mrY4YdSU 2kyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BwNoObkJ; 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 mw18-20020a17090b4d1200b001fe30008cd0si4265810pjb.166.2022.10.12.18.11.19; Wed, 12 Oct 2022 18:11:30 -0700 (PDT) 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=BwNoObkJ; 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 S232445AbiJMAlQ (ORCPT + 99 others); Wed, 12 Oct 2022 20:41:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232176AbiJMAiE (ORCPT ); Wed, 12 Oct 2022 20:38:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2F7EEE0AC; Wed, 12 Oct 2022 17:32:04 -0700 (PDT) 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 3A4B3B81CC0; Thu, 13 Oct 2022 00:22:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEBCBC433D6; Thu, 13 Oct 2022 00:22:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665620530; bh=tmSEkFufYVR+3W1hXp/LsNelCsoDMRgiS0GAeQ7Nu+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BwNoObkJRP01C9yxGrkbZGMeGu0XLtwcTs76vZM7m6yp8OwtkSEgX1bDAvoajrWmv uefckgCzGnAzDOmkXciQjNz6oz9udm09pRcg64RLJXuRURg53Fbiqap6zDdQ54ARIG fJJQ8pKJ3BPkq7hufZGb00LmYWC1NCdPfe6CgEj+DEno3Ek3Z1tOi7XBcez7X0L7MC hCsxw5UjL1z/ET3xpeRcpJgxuQXw30PAwuWxl/EpRzlFTNrVNsdsdqy1IUpwj+p6m2 Px5nETM5twvXaEHrv2eR+MCOv3tX7+Myq/Nlt1OPa76Tv9qnqj9XynXN0E/pwIaaxZ OzzOabo1fb34w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: GUO Zihua , Greg Kroah-Hartman , Sasha Levin , philipp.g.hortmann@gmail.com, yogi.kernel@gmail.com, yangyingliang@huawei.com, paskripkin@gmail.com, dave@stgolabs.net, f3sch.git@outlook.com, linux-staging@lists.linux.dev Subject: [PATCH AUTOSEL 5.15 12/47] staging: rtl8192e: Fix return type for implementation of ndo_start_xmit Date: Wed, 12 Oct 2022 20:20:47 -0400 Message-Id: <20221013002124.1894077-12-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221013002124.1894077-1-sashal@kernel.org> References: <20221013002124.1894077-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: GUO Zihua [ Upstream commit 513d9a61156d79dd0979c4ad400c8587f52cbb9d ] CFI (Control Flow Integrity) is a safety feature allowing the system to detect and react should a potential control flow hijacking occurs. In particular, the Forward-Edge CFI protects indirect function calls by ensuring the prototype of function that is actually called matches the definition of the function hook. Since Linux now supports CFI, it will be a good idea to fix mismatched return type for implementation of hooks. Otherwise this would get cought out by CFI and cause a panic. Use enums from netdev_tx_t as return value instead, then change return type to netdev_tx_t. Note that rtllib_xmit_inter() would return 1 only on allocation failure and the queue is stopped if that happens, meeting the documented requirement if NETDEV_TX_BUSY should be returned by ndo_start_xmit. Signed-off-by: GUO Zihua Link: https://lore.kernel.org/r/20220905130053.10731-1-guozihua@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/rtl8192e/rtllib.h | 2 +- drivers/staging/rtl8192e/rtllib_tx.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index c985e4ebc545..a76f81302edd 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -1938,7 +1938,7 @@ int rtllib_encrypt_fragment( struct sk_buff *frag, int hdr_len); -int rtllib_xmit(struct sk_buff *skb, struct net_device *dev); +netdev_tx_t rtllib_xmit(struct sk_buff *skb, struct net_device *dev); void rtllib_txb_free(struct rtllib_txb *txb); /* rtllib_rx.c */ diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index 37715afb0210..71c9e29449c6 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -964,9 +964,9 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) } -int rtllib_xmit(struct sk_buff *skb, struct net_device *dev) +netdev_tx_t rtllib_xmit(struct sk_buff *skb, struct net_device *dev) { memset(skb->cb, 0, sizeof(skb->cb)); - return rtllib_xmit_inter(skb, dev); + return rtllib_xmit_inter(skb, dev) ? NETDEV_TX_BUSY : NETDEV_TX_OK; } EXPORT_SYMBOL(rtllib_xmit); -- 2.35.1