mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Denis Kirjanov <dkirjanov@suse.de>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>,
	mailhol.vincent@wanadoo.fr, wg@grandegger.com,
	mkl@pengutronix.de, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com,
	arunachalam.santhanam@in.bosch.com
Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] can: etas_es58x: Add check for alloc_can_err_skb
Date: Fri, 1 Sep 2023 14:12:25 +0300	[thread overview]
Message-ID: <4d953daf-f426-e2fe-ca27-6da30fddaa40@suse.de> (raw)
In-Reply-To: <20230901082755.27104-1-jiasheng@iscas.ac.cn>



On 9/1/23 11:27, Jiasheng Jiang wrote:
> Add check for the return value of alloc_can_err_skb in order to
> avoid NULL pointer dereference.
> 
> Fixes: 8537257874e9 ("can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>  drivers/net/can/usb/etas_es58x/es58x_core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c
> index 0c7f7505632c..d694cb22d9f4 100644
> --- a/drivers/net/can/usb/etas_es58x/es58x_core.c
> +++ b/drivers/net/can/usb/etas_es58x/es58x_core.c
> @@ -680,6 +680,8 @@ int es58x_rx_err_msg(struct net_device *netdev, enum es58x_err error,
>  	}
>  
>  	skb = alloc_can_err_skb(netdev, &cf);
> +	if (!skb)
> +		return -ENOMEM;

Should you adjust the stats for dropped packets as well?

>  
>  	switch (error) {
>  	case ES58X_ERR_OK:	/* 0: No error */

      parent reply	other threads:[~2023-09-01 11:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01  8:27 Jiasheng Jiang
2023-09-01 10:53 ` Vincent MAILHOL
2023-09-01 11:12 ` Denis Kirjanov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4d953daf-f426-e2fe-ca27-6da30fddaa40@suse.de \
    --to=dkirjanov@suse.de \
    --cc=arunachalam.santhanam@in.bosch.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiasheng@iscas.ac.cn \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®