[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20221018094821.GG1264@duo.ucw.cz>
Date: Tue, 18 Oct 2022 11:48:21 +0200
From: Pavel Machek <pavel@...x.de>
To: Sasha Levin <sashal@...nel.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
GUO Zihua <guozihua@...wei.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
philipp.g.hortmann@...il.com, dave@...olabs.net,
paskripkin@...il.com, dan.carpenter@...cle.com,
yogi.kernel@...il.com, yangyingliang@...wei.com,
f3sch.git@...look.com, linux-staging@...ts.linux.dev
Subject: Re: [PATCH AUTOSEL 5.10 10/33] staging: rtl8192e: Fix return type
for implementation of ndo_start_xmit
Hi!
> [ 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.
>
> +++ 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);
First, rtllib_xmit_inter() should be fixed to return the enum, too.
Second, we really should not take this to stable, as CFI is not
available there. We should drop these patches:
4.19 14/19] staging: rtl8192u: Fix return type of ieee80211_xmit
5.10 09/33] staging: rtl8712: Fix return type for implementation of ndo_start_xmit
5.10 10/33] staging: rtl8192e: Fix return type for implementation of ndo_start_xmit
Thank you,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists