scsi: fcoe: return value of skb_linearize should be handled
PATCH 1/1 scsi: fcoe: return value of skb_linearize should be handled
Return value of skb_linearize should be handled.
--- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 6 ++++-- drivers/scsi/fcoe/fcoe.c | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +4 -2
@@ -542,8 +542,10 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)return ; } -if (skb_is_nonlinear (skb)) -skb_linearize (skb); +if (skb_linearize (skb)) { +kfree_skb (skb); +return ; + } mac =eth_hdr (skb)->h_source; dest_mac =eth_hdr (skb)->h_dest;
drivers/scsi/fcoe/fcoe.c +4 -1
@@ -1685,7 +1685,10 @@ static void fcoe_recv_frame(struct sk_buff *skb) skb->dev ? skb->dev->name : "<NULL>"); port =lport_priv (lport); -skb_linearize (skb);/* check for skb_is_nonlinear is within skb_linearize */ +if (skb_linearize (skb)) { +kfree_skb (skb); +return ; + }/* * Frame length checks and setting up the header pointers
Signature · 1 line
1.9.1
Hi Zhouyi,
Quoted 49 lines · Zhouyi Zhou
Return value of
skb_linearizeshould be handled.Signed-off-by Zhouyi Zhou <yizhouzhou-6xnC4QlcT6v/[email protected]>Reviewed-by Yuval Shaia <[email protected]>--- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 6 ++++-- drivers/scsi/fcoe/fcoe.c | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-)drivers/scsi/bnx2fc/bnx2fc_fcoe.c +4
-2@@ -542,8 +542,10 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)return ; } -if (skb_is_nonlinear (skb)) -skb_linearize (skb); +if (skb_linearize (skb)) { +kfree_skb (skb); +return ; + } mac =eth_hdr (skb)->h_source; dest_mac =eth_hdr (skb)->h_dest;drivers/scsi/fcoe/fcoe.c +4
-1@@ -1685,7 +1685,10 @@ static void fcoe_recv_frame(struct sk_buff *skb) skb->dev ? skb->dev->name : "<NULL>"); port =lport_priv (lport); -skb_linearize (skb);/* check for skb_is_nonlinear is within skb_linearize */ +if (skb_linearize (skb)) { +kfree_skb (skb); +return ; + }/* * Frame length checks and setting up the header pointers Signature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
I'd personally prefer something like:
drivers/scsi/fcoe/fcoe.c +4 -4
@@ -1673,8 +1673,7 @@ static void fcoe_recv_frame(struct sk_buff *skb) lport = fr->fr_dev;if (unlikely (!lport)) {FCOE_NETDEV_DBG (skb->dev,"NULL lport in skb\n" ); -kfree_skb (skb); -return ; + goto free_skb; } FCOE_NETDEV_DBG(skb->dev,
@@ -1685,8 +1684,8 @@ static void fcoe_recv_frame(struct sk_buff *skb) skb->dev ? skb->dev->name : "<NULL>"); port =lport_priv (lport); -skb_linearize (skb);/* check for skb_is_nonlinear is within skb_linearize */ - +if (skb_linearize (skb)) + goto free_skb;/* * Frame length checks and setting up the header pointers * was done in fcoe_rcv already.
@@ -1732,6 +1731,7 @@ static void fcoe_recv_frame(struct sk_buff *skb) drop: stats->ErrorFrames++;put_cpu (); +free_skb:kfree_skb (skb); }
For bnx2fc as well if Chad agrees.
Thanks,
Johannes
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Thanks Johannes for reviewing, your code is indeeded more elegant
Quoted 93 lines · Johannes Thumshirn
Hi Zhouyi,
Quoted 45 lines · Zhouyi Zhou
Return value of
skb_linearizeshould be handled.Signed-off-by Zhouyi Zhou <[email protected]>Reviewed-by Yuval Shaia <[email protected]>--- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 6 ++++-- drivers/scsi/fcoe/fcoe.c | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-)drivers/scsi/bnx2fc/bnx2fc_fcoe.c +4
-2@@ -542,8 +542,10 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)return ; } -if (skb_is_nonlinear (skb)) -skb_linearize (skb); +if (skb_linearize (skb)) { +kfree_skb (skb); +return ; + } mac =eth_hdr (skb)->h_source; dest_mac =eth_hdr (skb)->h_dest;drivers/scsi/fcoe/fcoe.c +4
-2@@ -1685,7 +1685,10 @@ static void fcoe_recv_frame(struct sk_buff *skb) skb->dev ? skb->dev->name : "<NULL>"); port =lport_priv (lport); -skb_linearize (skb);/* check for skb_is_nonlinear is within skb_linearize */ +if (skb_linearize (skb)) { +kfree_skb (skb); +return ; + }/* * Frame length checks and setting up the header pointers -- 1.9.1
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlI'd personally prefer something like:
drivers/scsi/fcoe/fcoe.c +4
-4@@ -1673,8 +1673,7 @@ static void fcoe_recv_frame(struct sk_buff *skb) lport = fr->fr_dev;if (unlikely (!lport)) {FCOE_NETDEV_DBG (skb->dev,"NULL lport in skb\n" ); -kfree_skb (skb); -return ; + goto free_skb; } FCOE_NETDEV_DBG(skb->dev,@@ -1685,8 +1684,8 @@ static void fcoe_recv_frame(struct sk_buff *skb) skb->dev ? skb->dev->name : "<NULL>"); port =lport_priv (lport); -skb_linearize (skb);/* check for skb_is_nonlinear is within skb_linearize */ - +if (skb_linearize (skb)) + goto free_skb;/* * Frame length checks and setting up the header pointers * was done in fcoe_rcv already. @@ -1732,6 +1731,7 @@ static void fcoe_recv_frame(struct sk_buff *skb) drop: stats->ErrorFrames++;put_cpu (); +free_skb:kfree_skb (skb); }For bnx2fc as well if Chad agrees.
Thanks,
Johannes
Quoted 7 lines
--
Johannes Thumshirn Storage
[email protected] +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Thanks
Zhouyi