Subject: Re: [PATCH v2] nfc: virtual_ncidev: Fix memory leak in virtual_nci_send()

From: Jakub Kicinski <[email-masked]>
Date: Wed, 19 Oct 2022 17:33:51 -0700

On Tue, 18 Oct 2022 19:49:35 +0800 Shang XiaoJing wrote:
> --- a/drivers/nfc/virtual_ncidev.c
> +++ b/drivers/nfc/virtual_ncidev.c
> @@ -54,16 +54,19 @@ static int virtual_nci_send(struct nci_dev *ndev, struct sk_buff *skb)
>  	mutex_lock(&nci_mutex);
>  	if (state != virtual_ncidev_enabled) {
>  		mutex_unlock(&nci_mutex);
> +		consume_skb(skb);
>  		return 0;
>  	}
>  
>  	if (send_buff) {
>  		mutex_unlock(&nci_mutex);
> +		consume_skb(skb);
>  		return -1;

these two should be kfree_skb() as we're dropping a packet