Subject: Re: [PATCH net] net/smc: avoid NULL deref of conn->lnk in smc_msg_event tracepoint

From: Leon Romanovsky <[email-masked]>
Date: Sun, 17 May 2026 11:45:13 +0300

On Sun, May 10, 2026 at 03:26:40PM -0700, Xiang Mei wrote:
> The smc_msg_event tracepoint class, shared by smc_tx_sendmsg and
> smc_rx_recvmsg, unconditionally dereferences smc->conn.lnk:
> 
> 	__string(name, smc->conn.lnk->ibname)

My comment is not directly related to this patch, but it was triggered
while reviewing it. The ibname should not be cached, as users can rename
it through rdmatool or udev.

For example, this function is racy:
   552 static int smc_nl_handle_smcr_dev(struct smc_ib_device *smcibdev,
   553                                   struct sk_buff *skb,
   554                                   struct netlink_callback *cb)
   555 {
   ...
   582         snprintf(smc_ibname, sizeof(smc_ibname), "%s", smcibdev->ibdev->name);

Thanks