Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Partially revert "net/smc: Add netlink net namespace support"

The change of sizeof(struct smc_diag_linkinfo) by commit 79d39fc503b4
("net/smc: Add netlink net namespace support") introduced an ABI
regression: since struct smc_diag_lgrinfo contains an object of
type "struct smc_diag_linkinfo", offset of all subsequent members
of struct smc_diag_lgrinfo was changed by that change.

As result, applications compiled with the old version
of struct smc_diag_linkinfo will receive garbage in
struct smc_diag_lgrinfo.role if the kernel implements
this new version of struct smc_diag_linkinfo.

Fix this regression by reverting the part of commit 79d39fc503b4 that
changes struct smc_diag_linkinfo. After all, there is SMC_GEN_NETLINK
interface which is good enough, so there is probably no need to touch
the smc_diag ABI in the first place.

Fixes: 79d39fc503b4 ("net/smc: Add netlink net namespace support")
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Reviewed-by: Karsten Graul <kgraul@linux.ibm.com>
Link: https://lore.kernel.org/r/20220202030904.GA9742@altlinux.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Dmitry V. Levin and committed by
Jakub Kicinski
c86d8613 c8ff576e

+5 -8
+5 -6
include/uapi/linux/smc_diag.h
··· 84 84 /* SMC_DIAG_LINKINFO */ 85 85 86 86 struct smc_diag_linkinfo { 87 - __u8 link_id; /* link identifier */ 88 - __u8 ibname[IB_DEVICE_NAME_MAX]; /* name of the RDMA device */ 89 - __u8 ibport; /* RDMA device port number */ 90 - __u8 gid[40]; /* local GID */ 91 - __u8 peer_gid[40]; /* peer GID */ 92 - __aligned_u64 net_cookie; /* RDMA device net namespace */ 87 + __u8 link_id; /* link identifier */ 88 + __u8 ibname[IB_DEVICE_NAME_MAX]; /* name of the RDMA device */ 89 + __u8 ibport; /* RDMA device port number */ 90 + __u8 gid[40]; /* local GID */ 91 + __u8 peer_gid[40]; /* peer GID */ 93 92 }; 94 93 95 94 struct smc_diag_lgrinfo {
-2
net/smc/smc_diag.c
··· 146 146 (req->diag_ext & (1 << (SMC_DIAG_LGRINFO - 1))) && 147 147 !list_empty(&smc->conn.lgr->list)) { 148 148 struct smc_link *link = smc->conn.lnk; 149 - struct net *net = read_pnet(&link->smcibdev->ibdev->coredev.rdma_net); 150 149 151 150 struct smc_diag_lgrinfo linfo = { 152 151 .role = smc->conn.lgr->role, 153 152 .lnk[0].ibport = link->ibport, 154 153 .lnk[0].link_id = link->link_id, 155 - .lnk[0].net_cookie = net->net_cookie, 156 154 }; 157 155 158 156 memcpy(linfo.lnk[0].ibname,