Re: [PATCH AUTOSEL 5.10 10/33] staging: rtl8192e: Fix return type for implementation of ndo_start_xmit
From: Pavel Machek
Date: Tue Oct 18 2022 - 05:48:37 EST
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
Attachment:
signature.asc
Description: PGP signature