Re: [PATCH net,v4] net/smc: prevent NULL pointer dereference in txopt_get

From: Alexandra Winter
Date: Wed Aug 14 2024 - 09:22:25 EST




On 14.08.24 15:11, D. Wythe wrote:
>     struct smc_sock {                /* smc sock container */
> -    struct sock        sk;
> +    union {
> +        struct sock        sk;
> +        struct inet_sock    inet;
> +    };


I don't see a path where this breaks, but it looks risky to me.
Is an smc_sock always an inet_sock as well? Then can't you go with smc_sock->inet_sock->sk ?
Or only in the IPPROTO SMC case, and in the AF_SMC case it is not an inet_sock?