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

Message ID a94e5fa397a64ae3a676ec11ea09aaba@AUSX13MPS302.AMER.DELL.COM
State New
Headers show
Series
  • net/ncsi: Fix the payload copying for the request coming from Netlink
Related show

Commit Message

Justin.Lee1@Dell.com Aug. 21, 2019, 9:24 p.m. UTC
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>

---
 net/ncsi/ncsi-cmd.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Vijay Khemka Aug. 22, 2019, 8:34 p.m. UTC | #1
LGTM.



´╗┐On 8/21/19, 2:26 PM, "openbmc on behalf of Justin.Lee1@Dell.com" <openbmc-bounces+vijaykhemka=fb.com@lists.ozlabs.org on behalf of Justin.Lee1@Dell.com> wrote:

    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>
    
    ---
     net/ncsi/ncsi-cmd.c | 11 +++++++++--
     1 file changed, 9 insertions(+), 2 deletions(-)
    
    diff --git a/net/ncsi/ncsi-cmd.c b/net/ncsi/ncsi-cmd.c
    index eab4346..0187e65 100644
    --- a/net/ncsi/ncsi-cmd.c
    +++ b/net/ncsi/ncsi-cmd.c
    @@ -309,14 +309,21 @@ static struct ncsi_request *ncsi_alloc_command(struct ncsi_cmd_arg *nca)
     
     int ncsi_xmit_cmd(struct ncsi_cmd_arg *nca)
     {
    +	struct ncsi_cmd_handler *nch = NULL;
     	struct ncsi_request *nr;
    +	unsigned char type;
     	struct ethhdr *eh;
    -	struct ncsi_cmd_handler *nch = NULL;
     	int i, ret;
     
    +	/* Use OEM generic handler for Netlink request */
    +	if (nca->req_flags == NCSI_REQ_FLAG_NETLINK_DRIVEN)
    +		type = NCSI_PKT_CMD_OEM;
    +	else
    +		type = nca->type;
    +
     	/* Search for the handler */
     	for (i = 0; i < ARRAY_SIZE(ncsi_cmd_handlers); i++) {
    -		if (ncsi_cmd_handlers[i].type == nca->type) {
    +		if (ncsi_cmd_handlers[i].type == type) {
     			if (ncsi_cmd_handlers[i].handler)
     				nch = &ncsi_cmd_handlers[i];
     			else
    -- 
    2.9.3
David Miller Aug. 23, 2019, 2:27 a.m. UTC | #2
From: <Justin.Lee1@Dell.com>
Date: Wed, 21 Aug 2019 21:24:52 +0000

> 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>

Applied, thank you.

Patch
diff mbox series

diff --git a/net/ncsi/ncsi-cmd.c b/net/ncsi/ncsi-cmd.c
index eab4346..0187e65 100644
--- a/net/ncsi/ncsi-cmd.c
+++ b/net/ncsi/ncsi-cmd.c
@@ -309,14 +309,21 @@  static struct ncsi_request *ncsi_alloc_command(struct ncsi_cmd_arg *nca)
 
 int ncsi_xmit_cmd(struct ncsi_cmd_arg *nca)
 {
+	struct ncsi_cmd_handler *nch = NULL;
 	struct ncsi_request *nr;
+	unsigned char type;
 	struct ethhdr *eh;
-	struct ncsi_cmd_handler *nch = NULL;
 	int i, ret;
 
+	/* Use OEM generic handler for Netlink request */
+	if (nca->req_flags == NCSI_REQ_FLAG_NETLINK_DRIVEN)
+		type = NCSI_PKT_CMD_OEM;
+	else
+		type = nca->type;
+
 	/* Search for the handler */
 	for (i = 0; i < ARRAY_SIZE(ncsi_cmd_handlers); i++) {
-		if (ncsi_cmd_handlers[i].type == nca->type) {
+		if (ncsi_cmd_handlers[i].type == type) {
 			if (ncsi_cmd_handlers[i].handler)
 				nch = &ncsi_cmd_handlers[i];
 			else