> -----Original Message----- > From: linux-rdma-owner@xxxxxxxxxxxxxxx [mailto:linux-rdma- > owner@xxxxxxxxxxxxxxx] On Behalf Of Leon Romanovsky > Sent: Friday, October 20, 2017 12:20 PM > To: Wan, Kaike > Cc: Ruhl, Michael J; linux-rdma@xxxxxxxxxxxxxxx > Subject: Re: [PATCH] RDMA/netlink: OOPs in rdma_nl_rcv_msg() from > misinterpreted flag > > On Fri, Oct 20, 2017 at 12:18:02PM +0000, Wan, Kaike wrote: > > The nlmsg_flags from 0x100 and up have always been overloaded for > different requests, as shown in include/uapi/linux/netlink.h: > > Exactly, they are overloaded in include/uapi/linux/netlink.h where all nlmsg > flags are declared and not in some random rdma*.h file. Since they are known to be overloaded, how could you depend on the flags to make decision for all requests/responses? The reason for defining RDMA_NL_LS_F_ERR in include/uapi/rdma/rdma_netlink is that all LS related defines and structures are defined in the file. It is true that it can lead to misuse, just like the current code. However, the defines in include/uapi/linux/netlink.h un-mistakenly indicate that those bits can be overloaded. > > But it is not my main point. > > My main point is lack of usage of NLMSG_ERROR messages to inform about > errors, exactly as kernel informs users about errors in netlink, but in the > opposite direction. The difference is that the LS needs all the original information (request type, client index, msg_seq, etc) to match the response with the original request. Therefore, the easiest thing to do is to return the response with the original info plus an error flag, instead of using the NLMSG_ERROR message. > > > > > > In meanwhile, can we implement dummy dumpit functions for the LS, > > > which reuse ib_nl_is_good_ip_resp? > > > > Why do you want to jump all the dump hoops instead of directly calling the > response handler? LS is different from other netlink channels in that it sends > request from kernel to user space and receives responses from it instead of > the other way around. Consequently, the handling of netlink responses may > be different from handing requests from user space. > > > > Doesn't the part of email below answers on the question "why"? No. A response should not necessarily be processed the same as a request. > > > > > > > I prefer this solution over yours, because it doesn't mix > > > LS-specifics with general decision function and leaves LS anomalies in the > LS-relevant code. > > > > > > > > And returning 0 in absence of dumpit function as a response with > > > NLM_F_DUMP flag is wrong. User should be aware of the fact that > > > something wrong was with his request. > > > > > > Thanks > > > > > -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html