From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
Oliver Hartkopp <socketcan@hartkopp.net>,
linux-can@vger.kernel.org
Cc: netdev@vger.kernel.org, Wolfgang Grandegger <wg@grandegger.com>,
Stephane Grosjean <s.grosjean@peak-system.com>,
Loris Fauster <loris.fauster@ttcontrol.com>,
Alejandro Concepcion Rodriguez <alejandro@acoro.eu>,
Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH v4 0/3] Fix several use after free bugs
Date: Wed, 20 Jan 2021 13:34:38 +0100 [thread overview]
Message-ID: <5109c0d9-abd7-f4a0-e49c-a4f3a1bbd6c2@pengutronix.de> (raw)
In-Reply-To: <20210120114137.200019-1-mailhol.vincent@wanadoo.fr>
[-- Attachment #1.1: Type: text/plain, Size: 1935 bytes --]
On 1/20/21 12:41 PM, Vincent Mailhol wrote:
> This series fix three bugs which all have the same root cause.
>
> When calling netif_rx(skb) and its variants, the skb will eventually
> get consumed (or freed) and thus it is unsafe to dereference it after
> the call returns.
>
> This remark especially applies to any variable with aliases the skb
> memory which is the case of the can(fd)_frame.
>
> The pattern is as this:
> skb = alloc_can_skb(dev, &cf);
> /* Do stuff */
> netif_rx(skb);
> stats->rx_bytes += cf->len;
>
> Increasing the stats should be done *before* the call to netif_rx()
> while the skb is still safe to use.
>
> Changes since v3:
> - Patch 1/3: move the comments for upstream after the --- scissors
>
> Changes since v2:
> - rebase on net/master
> - Patch 1/3: Added a comment towards upstream to inform about a
> conflict which will occur when net-next and net are merged
> Ref: https://lore.kernel.org/linux-can/20210120085356.m7nabbw5zhy7prpo@hardanger.blackshift.org/
>
> Changes since v1:
> - fix a silly typo in patch 2/3 (variable len was declared twice...)
>
> Vincent Mailhol (3):
> can: dev: can_restart: fix use after free bug
> can: vxcan: vxcan_xmit: fix use after free bug
> can: peak_usb: fix use after free bugs
>
> drivers/net/can/dev.c | 4 ++--
> drivers/net/can/usb/peak_usb/pcan_usb_fd.c | 8 ++++----
> drivers/net/can/vxcan.c | 6 ++++--
> 3 files changed, 10 insertions(+), 8 deletions(-)
Applied to linux-can-testing. I don't know why 2/3 hasn't made it to the mail
archive yet.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-01-20 20:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-20 11:41 [PATCH v4 0/3] Fix several use after free bugs Vincent Mailhol
2021-01-20 11:41 ` [PATCH v4 1/3] can: dev: can_restart: fix use after free bug Vincent Mailhol
2021-01-20 12:53 ` Marc Kleine-Budde
2021-01-20 13:30 ` Vincent MAILHOL
2021-01-20 11:41 ` [PATCH v4 2/3] can: vxcan: vxcan_xmit: " Vincent Mailhol
2021-01-20 11:41 ` [PATCH v4 3/3] can: peak_usb: fix use after free bugs Vincent Mailhol
2021-01-20 12:34 ` Marc Kleine-Budde [this message]
2021-01-20 17:30 ` [PATCH v4 0/3] Fix several " patchwork-bot+netdevbpf
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=5109c0d9-abd7-f4a0-e49c-a4f3a1bbd6c2@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=alejandro@acoro.eu \
--cc=dan.carpenter@oracle.com \
--cc=linux-can@vger.kernel.org \
--cc=loris.fauster@ttcontrol.com \
--cc=mailhol.vincent@wanadoo.fr \
--cc=netdev@vger.kernel.org \
--cc=s.grosjean@peak-system.com \
--cc=socketcan@hartkopp.net \
--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;
as well as URLs for NNTP newsgroup(s).