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>] [day] [month] [year] [list]
Date:   Wed, 15 Mar 2023 14:45:48 +0800
From:   Jiasheng Jiang <jiasheng@...as.ac.cn>
To:     simon.horman@...igine.com
Cc:     marcel@...tmann.org, johan.hedberg@...il.com, luiz.dentz@...il.com,
        davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
        pabeni@...hat.com, linux-bluetooth@...r.kernel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: Re: Re: [PATCH] Bluetooth: 6LoWPAN: Add missing check for skb_clone

On Tue, Mar 14, 2023 at 10:58:23PM +0800, Simon Horman wrote:
>On Mon, Mar 13, 2023 at 05:03:46PM +0800, Jiasheng Jiang wrote:
>> Add the check for the return value of skb_clone since it may return NULL
>> pointer and cause NULL pointer dereference in send_pkt.
>> 
>> Fixes: 18722c247023 ("Bluetooth: Enable 6LoWPAN support for BT LE devices")
>> Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
>> ---
>>  net/bluetooth/6lowpan.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>> 
>> diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
>> index 4eb1b3ced0d2..bf42a0b03e20 100644
>> --- a/net/bluetooth/6lowpan.c
>> +++ b/net/bluetooth/6lowpan.c
>> @@ -477,6 +477,10 @@ static int send_mcast_pkt(struct sk_buff *skb, struct net_device *netdev)
>>  			int ret;
>>  
>>  			local_skb = skb_clone(skb, GFP_ATOMIC);
>> +			if (!local_skb) {
>> +				rcu_read_unlock();
>> +				return -ENOMEM;
>> +			}
> 
> Further down in this loop an error is handled as follows,
> I wonder if that pattern is appropriate here too.
> 
> 			ret = send_pkt(pentry->chan, local_skb, netdev);
> 			if (ret < 0)
> 				err = ret;
> 

I think it should be better to return error here in order to avoid the
error being overwritten.
I will submit a v2 to modify the error handling here.

Thanks,
Jiang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ