public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8192e: Fix return type for implementation of ndo_start_xmit
@ 2022-09-08 20:32 Philipp Hortmann
  2022-09-09  7:56 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 7+ messages in thread
From: Philipp Hortmann @ 2022-09-08 20:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel, Dan Carpenter

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.

Suggested-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
Tested with rtl8192e
Transferred this patch over wlan connection of rtl8192e
---
 drivers/staging/rtl8192e/rtllib.h    |  2 +-
 drivers/staging/rtl8192e/rtllib_tx.c | 10 +++++-----
 2 files changed, 6 insertions(+), 6 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..ebcaf3bf22d6 100644
--- a/drivers/staging/rtl8192e/rtllib_tx.c
+++ b/drivers/staging/rtl8192e/rtllib_tx.c
@@ -543,7 +543,7 @@ static u8 rtllib_current_rate(struct rtllib_device *ieee)
 		return ieee->rate & 0x7F;
 }
 
-static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
+static netdev_tx_t rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
 {
 	struct rtllib_device *ieee = (struct rtllib_device *)
 				     netdev_priv_rsl(dev);
@@ -946,23 +946,23 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
 			if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
 				stats->tx_packets++;
 				stats->tx_bytes += le16_to_cpu(txb->payload_size);
-				return 0;
+				return NETDEV_TX_OK;
 			}
 			rtllib_txb_free(txb);
 		}
 	}
 
-	return 0;
+	return NETDEV_TX_OK;
 
  failed:
 	spin_unlock_irqrestore(&ieee->lock, flags);
 	netif_stop_queue(dev);
 	stats->tx_errors++;
-	return 1;
+	return NETDEV_TX_BUSY;
 
 }
 
-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);
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] staging: rtl8192e: Fix return type for implementation of ndo_start_xmit
  2022-09-08 20:32 [PATCH] staging: rtl8192e: Fix return type for implementation of ndo_start_xmit Philipp Hortmann
@ 2022-09-09  7:56 ` Greg Kroah-Hartman
  2022-09-09  7:58   ` Greg Kroah-Hartman
  2022-09-09  8:00   ` Greg Kroah-Hartman
  0 siblings, 2 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2022-09-09  7:56 UTC (permalink / raw)
  To: Philipp Hortmann; +Cc: linux-staging, linux-kernel, Dan Carpenter

On Thu, Sep 08, 2022 at 10:32:43PM +0200, Philipp Hortmann wrote:
> 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.
> 
> Suggested-by: Dan Carpenter <error27@gmail.com>
> Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
> ---
> Tested with rtl8192e
> Transferred this patch over wlan connection of rtl8192e
> ---
>  drivers/staging/rtl8192e/rtllib.h    |  2 +-
>  drivers/staging/rtl8192e/rtllib_tx.c | 10 +++++-----
>  2 files changed, 6 insertions(+), 6 deletions(-)

Someone sent the same patch before you did:
	https://lore.kernel.org/r/20220905130053.10731-1-guozihua@huawei.com


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] staging: rtl8192e: Fix return type for implementation of ndo_start_xmit
  2022-09-09  7:56 ` Greg Kroah-Hartman
@ 2022-09-09  7:58   ` Greg Kroah-Hartman
  2022-09-09  8:00   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2022-09-09  7:58 UTC (permalink / raw)
  To: Philipp Hortmann; +Cc: linux-staging, linux-kernel, Dan Carpenter

On Fri, Sep 09, 2022 at 09:56:59AM +0200, Greg Kroah-Hartman wrote:
> On Thu, Sep 08, 2022 at 10:32:43PM +0200, Philipp Hortmann wrote:
> > 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.
> > 
> > Suggested-by: Dan Carpenter <error27@gmail.com>
> > Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
> > ---
> > Tested with rtl8192e
> > Transferred this patch over wlan connection of rtl8192e
> > ---
> >  drivers/staging/rtl8192e/rtllib.h    |  2 +-
> >  drivers/staging/rtl8192e/rtllib_tx.c | 10 +++++-----
> >  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> Someone sent the same patch before you did:
> 	https://lore.kernel.org/r/20220905130053.10731-1-guozihua@huawei.com
> 

Ah, but that one did not apply, I'll take this one then...

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] staging: rtl8192e: Fix return type for implementation of ndo_start_xmit
  2022-09-09  7:56 ` Greg Kroah-Hartman
  2022-09-09  7:58   ` Greg Kroah-Hartman
@ 2022-09-09  8:00   ` Greg Kroah-Hartman
  2022-09-09 17:20     ` Philipp Hortmann
  1 sibling, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2022-09-09  8:00 UTC (permalink / raw)
  To: Philipp Hortmann; +Cc: linux-staging, linux-kernel, Dan Carpenter

On Fri, Sep 09, 2022 at 09:56:59AM +0200, Greg Kroah-Hartman wrote:
> On Thu, Sep 08, 2022 at 10:32:43PM +0200, Philipp Hortmann wrote:
> > 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.
> > 
> > Suggested-by: Dan Carpenter <error27@gmail.com>
> > Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
> > ---
> > Tested with rtl8192e
> > Transferred this patch over wlan connection of rtl8192e
> > ---
> >  drivers/staging/rtl8192e/rtllib.h    |  2 +-
> >  drivers/staging/rtl8192e/rtllib_tx.c | 10 +++++-----
> >  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> Someone sent the same patch before you did:
> 	https://lore.kernel.org/r/20220905130053.10731-1-guozihua@huawei.com
> 

This patch does not apply to my tree either :(

Please rebase and resubmit.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] staging: rtl8192e: Fix return type for implementation of ndo_start_xmit
  2022-09-09  8:00   ` Greg Kroah-Hartman
@ 2022-09-09 17:20     ` Philipp Hortmann
  2022-09-09 18:01       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 7+ messages in thread
From: Philipp Hortmann @ 2022-09-09 17:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Dan Carpenter, GUO Zihua

On 9/9/22 10:00, Greg Kroah-Hartman wrote:
> On Fri, Sep 09, 2022 at 09:56:59AM +0200, Greg Kroah-Hartman wrote:
>> On Thu, Sep 08, 2022 at 10:32:43PM +0200, Philipp Hortmann wrote:
>>> 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.
>>>
>>> Suggested-by: Dan Carpenter <error27@gmail.com>
>>> Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
>>> ---
>>> Tested with rtl8192e
>>> Transferred this patch over wlan connection of rtl8192e
>>> ---
>>>   drivers/staging/rtl8192e/rtllib.h    |  2 +-
>>>   drivers/staging/rtl8192e/rtllib_tx.c | 10 +++++-----
>>>   2 files changed, 6 insertions(+), 6 deletions(-)
>>
>> Someone sent the same patch before you did:
>> 	https://lore.kernel.org/r/20220905130053.10731-1-guozihua@huawei.com
>>
> 
> This patch does not apply to my tree either :(
> 
> Please rebase and resubmit.
> 
> thanks,
> 
> greg k-h


Sorry Greg,

I cannot find my error.
I just downloaded the patch and applied it to the staging-next branch 
and that worked fine.

Please find my logs below:


kernel@matrix-ESPRIMO-P710:~/Documents/git/kernels/staging$ git remote 
show origin
* remote origin
   Fetch URL: 
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
   Push  URL: 
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
   HEAD branch: master
   Remote branches:
     bus_cleanup     tracked
     greybus         tracked
     main            tracked
     master          tracked
     staging-linus   tracked
     staging-next    tracked
     staging-octeon  tracked
     staging-testing tracked
   Local branches configured for 'git pull':
     master          merges with remote master
     staging-next    merges with remote staging-next
     staging-testing merges with remote staging-testing
   Local refs configured for 'git push':
     master          pushes to master          (up to date)
     staging-next    pushes to staging-next    (up to date)
     staging-testing pushes to staging-testing (local out of date)


kernel@matrix-ESPRIMO-P710:~/Documents/git/kernels/staging$ git pull
Already up to date.


kernel@matrix-ESPRIMO-P710:~/Documents/git/kernels/staging$ git branch -a
   checkout
   master
* staging-next
   staging-testing
   remotes/origin/HEAD -> origin/master
   remotes/origin/bus_cleanup
   remotes/origin/greybus
   remotes/origin/main
   remotes/origin/master
   remotes/origin/staging-linus
   remotes/origin/staging-next
   remotes/origin/staging-octeon
   remotes/origin/staging-testing


kernel@matrix-ESPRIMO-P710:~/Documents/git/kernels/staging$ cat 
~/Downloads/PATCH-staging-rtl8192e-Fix-return-type-for-implementation-of-ndo_start_xmit.txt 
| git am
Applying: staging: rtl8192e: Fix return type for implementation of 
ndo_start_xmit


kernel@matrix-ESPRIMO-P710:~/Documents/git/kernels/staging$ git log
commit 1990e48f8e9fef88e044e65918566bd87f274b1c (HEAD -> staging-next)
Author: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Date:   Thu Sep 8 22:32:43 2022 +0200

     staging: rtl8192e: Fix return type for implementation of ndo_start_xmit

     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.

     Suggested-by: Dan Carpenter <error27@gmail.com>
     Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>

commit 28a2a54901f66a45ab339e944fdfc69667e639c1 (origin/staging-next, 
staging-testing)
Merge: 7bd581f3c263 7e18e42e4b28
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Mon Sep 5 07:57:37 2022 +0200

     Merge 6.0-rc4 into staging-next

     Resolves the merge issue with:
             drivers/staging/r8188eu/os_dep/os_intfs.c

     Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7e18e42e4b280c85b76967a9106a13ca61c16179 (tag: v6.0-rc4, 
origin/staging-linus, origin/main)


Or have you applied the patch already from GUO Zihua <guozihua@huawei.com>?

When I would have seen that GUO Zihua has send that patch already I 
would not have send it. Sorry.

Thanks for your support.

Bye Philipp

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] staging: rtl8192e: Fix return type for implementation of ndo_start_xmit
  2022-09-09 17:20     ` Philipp Hortmann
@ 2022-09-09 18:01       ` Greg Kroah-Hartman
  2022-09-09 18:24         ` Philipp Hortmann
  0 siblings, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2022-09-09 18:01 UTC (permalink / raw)
  To: Philipp Hortmann; +Cc: linux-staging, linux-kernel, Dan Carpenter, GUO Zihua

On Fri, Sep 09, 2022 at 07:20:09PM +0200, Philipp Hortmann wrote:
> On 9/9/22 10:00, Greg Kroah-Hartman wrote:
> > On Fri, Sep 09, 2022 at 09:56:59AM +0200, Greg Kroah-Hartman wrote:
> > > On Thu, Sep 08, 2022 at 10:32:43PM +0200, Philipp Hortmann wrote:
> > > > 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.
> > > > 
> > > > Suggested-by: Dan Carpenter <error27@gmail.com>
> > > > Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
> > > > ---
> > > > Tested with rtl8192e
> > > > Transferred this patch over wlan connection of rtl8192e
> > > > ---
> > > >   drivers/staging/rtl8192e/rtllib.h    |  2 +-
> > > >   drivers/staging/rtl8192e/rtllib_tx.c | 10 +++++-----
> > > >   2 files changed, 6 insertions(+), 6 deletions(-)
> > > 
> > > Someone sent the same patch before you did:
> > > 	https://lore.kernel.org/r/20220905130053.10731-1-guozihua@huawei.com
> > > 
> > 
> > This patch does not apply to my tree either :(
> > 
> > Please rebase and resubmit.
> > 
> > thanks,
> > 
> > greg k-h
> 
> 
> Sorry Greg,
> 
> I cannot find my error.
> I just downloaded the patch and applied it to the staging-next branch and
> that worked fine.

Try the staging-testing branch please.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] staging: rtl8192e: Fix return type for implementation of ndo_start_xmit
  2022-09-09 18:01       ` Greg Kroah-Hartman
@ 2022-09-09 18:24         ` Philipp Hortmann
  0 siblings, 0 replies; 7+ messages in thread
From: Philipp Hortmann @ 2022-09-09 18:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Dan Carpenter, GUO Zihua

On 9/9/22 20:01, Greg Kroah-Hartman wrote:
> On Fri, Sep 09, 2022 at 07:20:09PM +0200, Philipp Hortmann wrote:
>> On 9/9/22 10:00, Greg Kroah-Hartman wrote:
>>> On Fri, Sep 09, 2022 at 09:56:59AM +0200, Greg Kroah-Hartman wrote:
>>>> On Thu, Sep 08, 2022 at 10:32:43PM +0200, Philipp Hortmann wrote:
>>>>> 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.
>>>>>
>>>>> Suggested-by: Dan Carpenter <error27@gmail.com>
>>>>> Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
>>>>> ---
>>>>> Tested with rtl8192e
>>>>> Transferred this patch over wlan connection of rtl8192e
>>>>> ---
>>>>>    drivers/staging/rtl8192e/rtllib.h    |  2 +-
>>>>>    drivers/staging/rtl8192e/rtllib_tx.c | 10 +++++-----
>>>>>    2 files changed, 6 insertions(+), 6 deletions(-)
>>>>
>>>> Someone sent the same patch before you did:
>>>> 	https://lore.kernel.org/r/20220905130053.10731-1-guozihua@huawei.com
>>>>
>>>
>>> This patch does not apply to my tree either :(
>>>
>>> Please rebase and resubmit.
>>>
>>> thanks,
>>>
>>> greg k-h
>>
>>
>> Sorry Greg,
>>
>> I cannot find my error.
>> I just downloaded the patch and applied it to the staging-next branch and
>> that worked fine.
> 
> Try the staging-testing branch please.
> 
> thanks,
> 
> greg k-h

Hi Greg,

After switching the branch and a git pull the patch form GUO Zihua is 
already in.

Author: GUO Zihua <guozihua@huawei.com>
Date:   Mon Sep 5 21:00:53 2022 +0800

     staging: rtl8192e: Fix return type for implementation of ndo_start_xmit

So nothing to do.

Bye Philipp

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-09-09 18:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-08 20:32 [PATCH] staging: rtl8192e: Fix return type for implementation of ndo_start_xmit Philipp Hortmann
2022-09-09  7:56 ` Greg Kroah-Hartman
2022-09-09  7:58   ` Greg Kroah-Hartman
2022-09-09  8:00   ` Greg Kroah-Hartman
2022-09-09 17:20     ` Philipp Hortmann
2022-09-09 18:01       ` Greg Kroah-Hartman
2022-09-09 18:24         ` Philipp Hortmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox