Checks for Null value in function *get_skub
Subsystems (2)
PATCH v3 1/1 Checks for Null value in function *get_skub
--- drivers/infiniband/hw/cxgb4/cm.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/infiniband/hw/cxgb4/cm.c +2 -0
@@ -340,15 +340,13 @@ static int status2errno(int status)*/ static struct sk_buff *get_skb (struct sk_buff *skb,int len,gfp_t gfp) {if (skb && !skb_is_nonlinear (skb) && !skb_cloned (skb)) {skb_trim (skb,0 );skb_get (skb);skb_reset_transport_header (skb); }else { +if (skb) +kfree (skb); skb =alloc_skb (len, gfp); }t4_set_arp_err_handler (skb,NULL ,NULL );
Signature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
The bug is open here https://bugzilla.kernel.org/show_bug.cgi?id=44631.
I would recommend closing it now as I seem to have fixed it. Cheers Nick
Quoted 24 lines · Nicholas Krause
Signed-off-by Nicholas Krause <[email protected]>--- drivers/infiniband/hw/cxgb4/cm.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/infiniband/hw/cxgb4/cm.c +2
-1@@ -340,15 +340,13 @@ static int status2errno(int status)*/ static struct sk_buff *get_skb (struct sk_buff *skb,int len,gfp_t gfp) {if (skb && !skb_is_nonlinear (skb) && !skb_cloned (skb)) {skb_trim (skb,0 );skb_get (skb);skb_reset_transport_header (skb); }else { +if (skb) +kfree (skb); skb =alloc_skb (len, gfp); }t4_set_arp_err_handler (skb,NULL ,NULL ); --
Quoted 2 lines
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 14 lines · Nicholas Krause
Signed-off-by Nicholas Krause <[email protected]>--- drivers/infiniband/hw/cxgb4/cm.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/infiniband/hw/cxgb4/cm.c +0
-0@@ -340,15 +340,13 @@ static int status2errno(int status)*/ static struct sk_buff *get_skb (struct sk_buff *skb,int len,gfp_t gfp) {
drivers/infiniband/hw/cxgb4/cm.c static int status2errno(int status) · line 352
Quoted 10 lines
drivers/infiniband/hw/cxgb4/cm.c +2
-0if (skb && !skb_is_nonlinear (skb) && !skb_cloned (skb)) {skb_trim (skb,0 );skb_get (skb);skb_reset_transport_header (skb); }else { +if (skb) +kfree (skb); skb =alloc_skb (len, gfp); }t4_set_arp_err_handler (skb,NULL ,NULL );
Isn't kfree(NULL) legal?
(i.e. the if statement is useless)
Thanks,
Levente Kurusa
Quoted 1 line
From what I know yes so I would close the bug at the the link in
my previous email and just void my patch.
Cheers Nick
Quoted 30 lines · Levente Kurusa
Quoted 16 lines · Nicholas Krause
Signed-off-by Nicholas Krause <[email protected]>--- drivers/infiniband/hw/cxgb4/cm.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/infiniband/hw/cxgb4/cm.c +0
-0@@ -340,15 +340,13 @@ static int status2errno(int status)*/ static struct sk_buff *get_skb (struct sk_buff *skb,int len,gfp_t gfp) {drivers/infiniband/hw/cxgb4/cm.c static int status2errno(int status) · line 352
Quoted 10 lines
drivers/infiniband/hw/cxgb4/cm.c +2
-0if (skb && !skb_is_nonlinear (skb) && !skb_cloned (skb)) {skb_trim (skb,0 );skb_get (skb);skb_reset_transport_header (skb); }else { +if (skb) +kfree (skb); skb =alloc_skb (len, gfp); }t4_set_arp_err_handler (skb,NULL ,NULL );Isn't kfree(NULL) legal?
Quoted 4 lines
(i.e. the if statement is useless)
Thanks,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Nick Krause
Quoted 1 line
From what I know yes so I would close the bug at the the link in
my previous email and just void my patch.
Cheers Nick
We shouldn't be kfree-ing an skb anyway. Should use kfree_skb().
There is still a leak if skb is non-null and the skb is non linear or cloned.
Quoted 29 lines · Levente Kurusa
Quoted 28 lines · Nicholas Krause
Quoted 15 lines
Signed-off-by Nicholas Krause <[email protected]>--- drivers/infiniband/hw/cxgb4/cm.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/infiniband/hw/cxgb4/cm.c +0
-0@@ -340,15 +340,13 @@ static int status2errno(int status)*/ static struct sk_buff *get_skb (struct sk_buff *skb,int len,gfp_t gfp) {drivers/infiniband/hw/cxgb4/cm.c static int status2errno(int status) · line 352
Quoted 10 lines
drivers/infiniband/hw/cxgb4/cm.c +2
-0if (skb && !skb_is_nonlinear (skb) && !skb_cloned (skb)) {skb_trim (skb,0 );skb_get (skb);skb_reset_transport_header (skb); }else { +if (skb) +kfree (skb); skb =alloc_skb (len, gfp); }t4_set_arp_err_handler (skb,NULL ,NULL );Isn't kfree(NULL) legal?
Quoted 4 lines
Quoted 4 lines
(i.e. the if statement is useless)
Thanks,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html