Re: [PATCH v2] rust: net: netlink: validate attribute length before casting to `c_int`

From: Sagar Taunk

Date: Thu Sep 17 2026 - 10:59:45 EST


Thanks for the review. Also,I wanted to ask what do I put in the `Fixes` tag?
Like the commit which introduces it or explain the problem there?

Thanks,
Sagar Taunk


On Thursday, September 17th, 2026 at 3:05 PM, Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:

> On Tue, Sep 15, 2026 at 04:40:10PM +0000, Sagar Taunk wrote:
> > `put()` trusted an unchecked `as` cast from `usize` to `c_int`.
> > When the length exceeds `i32::MAX` that cast wraps around to a
> > negative value.
> >
> > This ultimately resulted in a kernel panic when the reinterpreted
> > value via `__nla_reserve()` and `skb_put()` became enormous.
> >
> > Validate payload and header both fit together in a `u16`, rejecting
> > any payload that wouldn't leave room for `NLA_HDRLEN`.
> >
> > Signed-off-by: Sagar Taunk <sagartaunk@xxxxxxxxx>
>
> This should include a Fixes: tag if it leads to a kernel panic.
>
> Can you also update the subject to [PATCH net vX] according to the
> guidelines in: Documentation/process/maintainer-netdev.rst
>
> The patch itself LGTM.
> Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
>
> Alice
>