Re: [PATCH] aoe: fix the potential use-after-free problem in more places

From: Markus Elfring
Date: Tue Apr 30 2024 - 12:16:58 EST


> For fixing CVE-2023-6270, f98364e92662 patch moved dev_put() from


Please add a subject for the mentioned commit hash.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.9-rc6#n99


> This patch adds dev_hold() to those functions and also uses dev_put()
> when the skb_clone() returns NULL.

Please improve this change description with a corresponding imperative wording.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.9-rc6#n94



> Fixes: f98364e92662 ("aoe: fix the potential use-after-free problem in
> aoecmd_cfg_pkts")

I suggest to omit a line break for this tag.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.9-rc6#n145



> +++ b/drivers/block/aoe/aoecmd.c

> @@ -401,7 +402,8 @@ aoecmd_ata_rw(struct aoedev *d)
> __skb_queue_head_init(&queue);
> __skb_queue_tail(&queue, skb);
> aoenet_xmit(&queue);
> - }
> + } else
> + dev_put(f->t->ifp->nd);
> return 1;
> }
>

> @@ -617,7 +622,8 @@ probe(struct aoetgt *t)
> __skb_queue_head_init(&queue);
> __skb_queue_tail(&queue, skb);
> aoenet_xmit(&queue);
> - }
> + } else
> + dev_put(f->t->ifp->nd);
> }
>
> static long


Should curly brackets be used for both if branches in these function implementations?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.9-rc6#n213

Regards,
Markus