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

net/ncsi: Fix the payload copying for the request coming from Netlink

The request coming from Netlink should use the OEM generic handler.

The standard command handler expects payload in bytes/words/dwords
but the actual payload is stored in data if the request is coming from Netlink.

Signed-off-by: Justin Lee <justin.lee1@dell.com>
Reviewed-by: Vijay Khemka <vijaykhemka@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Justin.Lee1@Dell.com and committed by
David S. Miller
f6edbf2d 4df0d839

+10 -3
+10 -3
net/ncsi/ncsi-cmd.c
··· 309 309 310 310 int ncsi_xmit_cmd(struct ncsi_cmd_arg *nca) 311 311 { 312 - struct ncsi_request *nr; 313 - struct ethhdr *eh; 314 312 struct ncsi_cmd_handler *nch = NULL; 313 + struct ncsi_request *nr; 314 + unsigned char type; 315 + struct ethhdr *eh; 315 316 int i, ret; 317 + 318 + /* Use OEM generic handler for Netlink request */ 319 + if (nca->req_flags == NCSI_REQ_FLAG_NETLINK_DRIVEN) 320 + type = NCSI_PKT_CMD_OEM; 321 + else 322 + type = nca->type; 316 323 317 324 /* Search for the handler */ 318 325 for (i = 0; i < ARRAY_SIZE(ncsi_cmd_handlers); i++) { 319 - if (ncsi_cmd_handlers[i].type == nca->type) { 326 + if (ncsi_cmd_handlers[i].type == type) { 320 327 if (ncsi_cmd_handlers[i].handler) 321 328 nch = &ncsi_cmd_handlers[i]; 322 329 else