Re: [PATCH net-next] ipv6: initialize ipcm6_cookie before parsing control messages
Fernando Fernandez Mancera <[email protected]>
| Newsgroups | org.infradead.lists.linux-mediatek,org.infradead.lists.linux-arm-kernel,org.kernel.vger.netdev |
|---|---|
| Message-ID | <178464510579.7763.6518393222506443032.b4-review@b4> |
On Thu, 09 Jul 2026 16:32:30 +0800, Wayen Yan <[email protected]> wrote: > ip6_datagram_send_ctl() parses both SOL_IPV6 and SOL_SOCKET control > messages. For SOL_SOCKET messages it passes ipc6->sockc to > __sock_cmsg_send(), which updates fields such as tsflags with > read-modify-write operations. > > The IPV6_2292PKTOPTIONS and flowlabel option paths only set ipc6.opt > before calling ip6_datagram_send_ctl(). If a SOL_SOCKET control message > such as SO_TIMESTAMPING_* or SCM_TS_OPT_ID is present, this can read > uninitialized sockc state. > > Initialize the ipcm6_cookie with ipcm6_init_sk(), as the normal IPv6 > sendmsg paths do, before overriding ->opt with the temporary option > buffer. > > Signed-off-by: Wayen Yan <[email protected]> > Reviewed-by: Fernando Fernandez Mancera <[email protected]> Thanks!