All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: ipv4: tcp_offload: check segs for NULL
@ 2016-12-15  8:47 shakya.das
  2016-12-15 13:43 ` Tobias Klauser
  2016-12-16  3:28 ` Eric Dumazet
  0 siblings, 2 replies; 3+ messages in thread
From: shakya.das @ 2016-12-15  8:47 UTC (permalink / raw)
  To: davem; +Cc: netdev, shakya89.das, vidushi.koul

From: Shakya Sundar Das <shakya.das@samsung.com>

This patch will check segs for being NULL in tcp_gso_segment()
before calling skb_shinfo(segs) from skb_is_gso(segs), otherwise
kernel can run into a NULL-pointer dereference.

Signed-off-by: Shakya Sundar Das <shakya.das@samsung.com>
---
 net/ipv4/tcp_offload.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c
index bc68da3..93feefd 100644
--- a/net/ipv4/tcp_offload.c
+++ b/net/ipv4/tcp_offload.c
@@ -96,7 +96,7 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb,
 	skb->ooo_okay = 0;
 
 	segs = skb_segment(skb, features);
-	if (IS_ERR(segs))
+	if (IS_ERR_OR_NULL(segs))
 		goto out;
 
 	/* Only first segment might have ooo_okay set */
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: ipv4: tcp_offload: check segs for NULL
  2016-12-15  8:47 [PATCH] net: ipv4: tcp_offload: check segs for NULL shakya.das
@ 2016-12-15 13:43 ` Tobias Klauser
  2016-12-16  3:28 ` Eric Dumazet
  1 sibling, 0 replies; 3+ messages in thread
From: Tobias Klauser @ 2016-12-15 13:43 UTC (permalink / raw)
  To: shakya.das; +Cc: davem, netdev, shakya89.das, vidushi.koul

On 2016-12-15 at 09:47:41 +0100, shakya.das@samsung.com <shakya.das@samsung.com> wrote:
> From: Shakya Sundar Das <shakya.das@samsung.com>
> 
> This patch will check segs for being NULL in tcp_gso_segment()
> before calling skb_shinfo(segs) from skb_is_gso(segs), otherwise
> kernel can run into a NULL-pointer dereference.

How can segs ever be NULL here? skb_segment() will always either return
an skb or an ERR_PTR(err).

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: ipv4: tcp_offload: check segs for NULL
  2016-12-15  8:47 [PATCH] net: ipv4: tcp_offload: check segs for NULL shakya.das
  2016-12-15 13:43 ` Tobias Klauser
@ 2016-12-16  3:28 ` Eric Dumazet
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2016-12-16  3:28 UTC (permalink / raw)
  To: shakya.das; +Cc: davem, netdev, shakya89.das, vidushi.koul

On Thu, 2016-12-15 at 14:17 +0530, shakya.das@samsung.com wrote:
> From: Shakya Sundar Das <shakya.das@samsung.com>
> 
> This patch will check segs for being NULL in tcp_gso_segment()
> before calling skb_shinfo(segs) from skb_is_gso(segs), otherwise
> kernel can run into a NULL-pointer dereference.
> 
> Signed-off-by: Shakya Sundar Das <shakya.das@samsung.com>
> ---
>  net/ipv4/tcp_offload.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c
> index bc68da3..93feefd 100644
> --- a/net/ipv4/tcp_offload.c
> +++ b/net/ipv4/tcp_offload.c
> @@ -96,7 +96,7 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb,
>  	skb->ooo_okay = 0;
>  
>  	segs = skb_segment(skb, features);
> -	if (IS_ERR(segs))
> +	if (IS_ERR_OR_NULL(segs))
>  		goto out;
>  
>  	/* Only first segment might have ooo_okay set */

I do not see how this can ever happen.

How did you come up with this patch exactly ???

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-16  3:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-15  8:47 [PATCH] net: ipv4: tcp_offload: check segs for NULL shakya.das
2016-12-15 13:43 ` Tobias Klauser
2016-12-16  3:28 ` Eric Dumazet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.