lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2026012007-playing-gala-87cd@gregkh>
Date: Tue, 20 Jan 2026 16:59:56 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Minu Jin <s9430939@...er.com>
Cc: andriy.shevchenko@...ux.intel.com, abrahamadekunle50@...il.com,
	dan.carpenter@...aro.org, milospuric856@...il.com,
	zxcv2569763104@...il.com, linux-staging@...ts.linux.dev,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] staging: rtl8723bs: fix unchecked return value of
 skb_copy_bits

On Wed, Jan 21, 2026 at 12:50:34AM +0900, Minu Jin wrote:
> The function _rtw_pktfile_read() incorrectly updated the file pointer
> even when skb_copy_bits() failed.
> 
> This patch fixes the issue by:
> 
>     1. Propagating the negative error code from skb_copy_bits() if
>        it fails, preventing internal pointer updates.
> 
>     2. Updating all callers (including set_qos) to check the return value
>        and handle errors appropriately.
> 
> Signed-off-by: Minu Jin <s9430939@...er.com>
> ---
> Changes in v3:
> 	- Convert set_qos() from void to int to properly propagate error codes
> 	  (suggested by Greg KH, Dan Carpenter)
> 
> 	- Use an intermediate 'ret' variable in set_qos() for cleaner error
> 	  handling (suggested by Dan Carpenter)
> 
> 	- Remove 'extern' from function prototype in the header file
> 	  (suggested by Andy Shevchenko)
> 
> 	- Apply reverse xmas tree ordering for local variables.
> 	  (suggested by Andy Shevchenko)
> 
> 	- Remove unnecessary blank lines in declaration blocks
> 	  (suggested by Andy Shevchenko, Dan Carpenter)
> 
> 	- Revert 'len' variable type to uint in _rtw_pktfile_read()
> 	  (suggested by Dan Carpenter)
> 
> 
>  drivers/staging/rtl8723bs/core/rtw_xmit.c     | 42 +++++++++++++++----
>  .../staging/rtl8723bs/include/xmit_osdep.h    |  2 +-
>  drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 12 ++++--
>  3 files changed, 42 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
> index 21690857fd62..f24f89ab65ad 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
> @@ -596,23 +596,31 @@ u8 qos_acm(u8 acm_mask, u8 priority)
>  	return priority;
>  }
>  
> -static void set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
> +static int set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
>  {
>  	struct ethhdr etherhdr;
>  	struct iphdr ip_hdr;
>  	s32 UserPriority = 0;
> +	int ret;
>  
>  	_rtw_open_pktfile(ppktfile->pkt, ppktfile);
> -	_rtw_pktfile_read(ppktfile, (unsigned char *)&etherhdr, ETH_HLEN);
> +	ret = _rtw_pktfile_read(ppktfile, (unsigned char *)&etherhdr, ETH_HLEN);
> +	if (ret < 0)
> +		return ret;

How can ret ever be less than 0?

Shouldn't you be checking something else here?

Hint, read the function to see what it does...

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ