Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp168406rwi; Wed, 12 Oct 2022 18:01:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oENnwnlhYOFQz7G7VvBgLkfBsBRVq+9asmOKt7Y8SW9OQqd/zLYA9fZdgBfwOIvrXOP0K X-Received: by 2002:a17:90b:3ece:b0:20a:ea98:b93e with SMTP id rm14-20020a17090b3ece00b0020aea98b93emr8174529pjb.123.1665622862627; Wed, 12 Oct 2022 18:01:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665622862; cv=none; d=google.com; s=arc-20160816; b=drhox5QgW0LFhxAuWsOmjgc9fKDE7o7WaLK3vJODpzZAed3Y7vcRJKl6/kkYmJK9HE nGUvD3YwIcHKkwf0F0RT81TBKpNtgoz4pqRmKlvvPBGp+C8OD4JKF1WD2Mqxi42cGGDd YqLDTAihqrDDi4d9DybOKkk+3DK4NspGiDlAf+jZjyGwf4Jmo7DyJ4mqV+zK/fNYSBCY XE6c+cWxhFNkOJd4s2xuaIX4GDfTSKChMbPad6G80StPCaYXpNofirsoOMIrSyzTFSNY ud78yoKo2/V/AA6xbilm1AEmUIvtWAJHFCPM6PGqBOQt5rw+wFsxLKc42O3QooPLKtW5 Isug== 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=z4DAiek75o6w3Jptz2oU2cV8nQwnInaydEnUYQWqM5o=; b=NS8hgkuLz91atQfZ6LDiyq7usi2UIBdgCDyM/o06m3+w3L2gL0sDIWUiqEQIJta0Xk Fg/t5BHOeCsZDPzrxMuhj5dsqljELhSJXI9UXqJJrb9I5fq3QKidOT54tDb2o/2CaGO4 6NfJFpwcuWQqWUzA06IBbX6gKGS0Mh+WLP7ljXySV9Bft2mNe02CBfuZ5b6kk5vFoRFk 3OmmqBR50oegHFCo3FvUn4L2IeucHwa1pMHU3hw6sKY5Ep85lTqhQOz+HEbjuEWEJv1Q KuqGfqzkM/a4N+JS28Z79Llw2JsDupvGfmAlwMGmOfwMWR4dMlw5sUnsoe5WVfaAXsAE lKbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DNYk59+m; 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 l187-20020a6391c4000000b0045fd05b2ce9si17329483pge.521.2022.10.12.18.00.51; Wed, 12 Oct 2022 18:01:02 -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=DNYk59+m; 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 S229918AbiJMARz (ORCPT + 99 others); Wed, 12 Oct 2022 20:17:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229916AbiJMAR0 (ORCPT ); Wed, 12 Oct 2022 20:17:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB4C4142CB1; Wed, 12 Oct 2022 17:16:49 -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 8978CB81CBE; Thu, 13 Oct 2022 00:16:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12B98C43470; Thu, 13 Oct 2022 00:16:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665620199; bh=jQxxa2emWIrP+XhwowD1jj1IDXQ6DNjIM/1vneiQ1Y8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DNYk59+mXdD52nM7uoZgQIqIa2wZAnbKkYmvWBcRJDuPuJCJeaV2ihtmroa1nnFSE LDaC/rAokLMBzYdsVFYiRJ9CAs2JW5qX5dfx0bBCcYQCVicDRvMH34a09Tm9BzybOW meY/yUpbQBXeM448xSN7FyOkjxycwNwXDg5F5OV7UdDYntaDNv4NxFhzJFg1h1Y7aZ kJRFsMUkUYetmls1Op4JsLJsy1EHamFVPk2EMrVaBxHX0eg4IYafEvdyOkDDTuUQlN Sq9nvrNoHdU2N8z427jB9p4UEjQUC2wE4C3KuIOQyHWgDbvMNWtOETnD/V5SyvxTKr /mJS1omHH6SOA== 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, yangyingliang@huawei.com, dave@stgolabs.net, yogi.kernel@gmail.com, f3sch.git@outlook.com, linux-staging@lists.linux.dev Subject: [PATCH AUTOSEL 6.0 16/67] staging: rtl8192e: Fix return type for implementation of ndo_start_xmit Date: Wed, 12 Oct 2022 20:14:57 -0400 Message-Id: <20221013001554.1892206-16-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221013001554.1892206-1-sashal@kernel.org> References: <20221013001554.1892206-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 0ecd81a81866..b4b606f552fb 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 42f81b23a144..9da83531932f 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -962,9 +962,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