public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch 0/3] NetworkPkg/TcpDxe: Fix some issues in TcpDxe driver.
@ 2017-12-22  7:07 Jiaxin Wu
  2017-12-22  7:07 ` [Patch 1/3] NetworkPkg/TcpDxe: Check FragmentBuffer for NULL before use Jiaxin Wu
  2017-12-22  7:07 ` [Patch 2/3] NetworkPkg/TcpDxe: Remove the redundant code Jiaxin Wu
  0 siblings, 2 replies; 5+ messages in thread
From: Jiaxin Wu @ 2017-12-22  7:07 UTC (permalink / raw)
  To: edk2-devel; +Cc: Fu Siyuan, Wang Fan, Ye Ting, Wu Jiaxin

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>

Jiaxin Wu (3):
  NetworkPkg/TcpDxe: Check FragmentBuffer for NULL before use
  NetworkPkg/TcpDxe: Remove the redundant code.
  NetworkPkg/TcpDxe: Check TCP payload for release version.

 NetworkPkg/TcpDxe/SockInterface.c |  46 --------------
 NetworkPkg/TcpDxe/Socket.h        |  21 +------
 NetworkPkg/TcpDxe/TcpInput.c      | 125 ++++++++++++++++++++++++++++++--------
 NetworkPkg/TcpDxe/TcpMain.c       |   3 +
 NetworkPkg/TcpDxe/TcpOutput.c     |  29 ++++++---
 5 files changed, 126 insertions(+), 98 deletions(-)

-- 
1.9.5.msysgit.1



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

* [Patch 1/3] NetworkPkg/TcpDxe: Check FragmentBuffer for NULL before use
  2017-12-22  7:07 [Patch 0/3] NetworkPkg/TcpDxe: Fix some issues in TcpDxe driver Jiaxin Wu
@ 2017-12-22  7:07 ` Jiaxin Wu
  2017-12-22  7:18   ` Fu, Siyuan
  2017-12-22  7:07 ` [Patch 2/3] NetworkPkg/TcpDxe: Remove the redundant code Jiaxin Wu
  1 sibling, 1 reply; 5+ messages in thread
From: Jiaxin Wu @ 2017-12-22  7:07 UTC (permalink / raw)
  To: edk2-devel; +Cc: Fu Siyuan, Wang Fan, Ye Ting, Wu Jiaxin

According the Spec, the FragmentBuffers in FragmentTable are allocated
by the application when calling Receive() function. This patch is to
check whether the FragmentBuffer is valid or not.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
 NetworkPkg/TcpDxe/TcpMain.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/NetworkPkg/TcpDxe/TcpMain.c b/NetworkPkg/TcpDxe/TcpMain.c
index fc3713e..e349d2d 100644
--- a/NetworkPkg/TcpDxe/TcpMain.c
+++ b/NetworkPkg/TcpDxe/TcpMain.c
@@ -38,10 +38,13 @@ TcpChkDataBuf (
   UINT32 Index;
 
   UINT32 Len;
 
   for (Index = 0, Len = 0; Index < FragmentCount; Index++) {
+    if (FragmentTable[Index].FragmentBuffer == NULL) {
+      return EFI_INVALID_PARAMETER;
+    }
     Len = Len + FragmentTable[Index].FragmentLength;
   }
 
   if (DataLen != Len) {
     return EFI_INVALID_PARAMETER;
-- 
1.9.5.msysgit.1



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

* [Patch 2/3] NetworkPkg/TcpDxe: Remove the redundant code.
  2017-12-22  7:07 [Patch 0/3] NetworkPkg/TcpDxe: Fix some issues in TcpDxe driver Jiaxin Wu
  2017-12-22  7:07 ` [Patch 1/3] NetworkPkg/TcpDxe: Check FragmentBuffer for NULL before use Jiaxin Wu
@ 2017-12-22  7:07 ` Jiaxin Wu
  2017-12-22  7:18   ` Fu, Siyuan
  1 sibling, 1 reply; 5+ messages in thread
From: Jiaxin Wu @ 2017-12-22  7:07 UTC (permalink / raw)
  To: edk2-devel; +Cc: Fu Siyuan, Wang Fan, Ye Ting, Wu Jiaxin

The function SockGroup() is not used by any other code. So,
it can be deleted.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
 NetworkPkg/TcpDxe/SockInterface.c | 46 ---------------------------------------
 NetworkPkg/TcpDxe/Socket.h        | 21 +-----------------
 2 files changed, 1 insertion(+), 66 deletions(-)

diff --git a/NetworkPkg/TcpDxe/SockInterface.c b/NetworkPkg/TcpDxe/SockInterface.c
index 0248cdf..0dfc0a7 100644
--- a/NetworkPkg/TcpDxe/SockInterface.c
+++ b/NetworkPkg/TcpDxe/SockInterface.c
@@ -1078,56 +1078,10 @@ SockGetMode (
 {
   return Sock->ProtoHandler (Sock, SOCK_MODE, Mode);
 }
 
 /**
-  Configure the low level protocol to join a multicast group for
-  this socket's connection.
-
-  @param[in]  Sock             Pointer to the socket of the connection to join the
-                               specific multicast group.
-  @param[in]  GroupInfo        Pointer to the multicast group info.
-
-  @retval EFI_SUCCESS          The configuration completed successfully.
-  @retval EFI_ACCESS_DENIED    Failed to get the lock to access the socket.
-  @retval EFI_NOT_STARTED      The socket is not configured.
-
-**/
-EFI_STATUS
-SockGroup (
-  IN SOCKET *Sock,
-  IN VOID   *GroupInfo
-  )
-{
-  EFI_STATUS  Status;
-
-  Status = EfiAcquireLockOrFail (&(Sock->Lock));
-
-  if (EFI_ERROR (Status)) {
-
-    DEBUG (
-      (EFI_D_ERROR,
-      "SockGroup: Get the access for socket failed with %r",
-      Status)
-      );
-
-    return EFI_ACCESS_DENIED;
-  }
-
-  if (SOCK_IS_UNCONFIGURED (Sock)) {
-    Status = EFI_NOT_STARTED;
-    goto Exit;
-  }
-
-  Status = Sock->ProtoHandler (Sock, SOCK_GROUP, GroupInfo);
-
-Exit:
-  EfiReleaseLock (&(Sock->Lock));
-  return Status;
-}
-
-/**
   Add or remove route information in IP route table associated
   with this socket.
 
   @param[in]  Sock             Pointer to the socket associated with the IP route
                                table to operate on.
diff --git a/NetworkPkg/TcpDxe/Socket.h b/NetworkPkg/TcpDxe/Socket.h
index f7f4a7a..26c5f4e 100644
--- a/NetworkPkg/TcpDxe/Socket.h
+++ b/NetworkPkg/TcpDxe/Socket.h
@@ -1,9 +1,9 @@
 /** @file
   Common head file for TCP socket.
 
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.php.
@@ -898,29 +898,10 @@ SockGetMode (
   IN     SOCKET *Sock,
   IN OUT VOID   *Mode
   );
 
 /**
-  Configure the low level protocol to join a multicast group for
-  this socket's connection.
-
-  @param[in]  Sock             Pointer to the socket of the connection to join the
-                               specific multicast group.
-  @param[in]  GroupInfo        Pointer to the multicast group information.
-
-  @retval EFI_SUCCESS          The configuration completed successfully.
-  @retval EFI_ACCESS_DENIED    Failed to get the lock to access the socket.
-  @retval EFI_NOT_STARTED      The socket is not configured.
-
-**/
-EFI_STATUS
-SockGroup (
-  IN SOCKET *Sock,
-  IN VOID   *GroupInfo
-  );
-
-/**
   Add or remove route information in IP route table associated
   with this socket.
 
   @param[in]  Sock             Pointer to the socket associated with the IP route
                                table to operate on.
-- 
1.9.5.msysgit.1



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

* Re: [Patch 1/3] NetworkPkg/TcpDxe: Check FragmentBuffer for NULL before use
  2017-12-22  7:07 ` [Patch 1/3] NetworkPkg/TcpDxe: Check FragmentBuffer for NULL before use Jiaxin Wu
@ 2017-12-22  7:18   ` Fu, Siyuan
  0 siblings, 0 replies; 5+ messages in thread
From: Fu, Siyuan @ 2017-12-22  7:18 UTC (permalink / raw)
  To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Wang, Fan, Ye, Ting

Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>

> -----Original Message-----
> From: Wu, Jiaxin
> Sent: Friday, December 22, 2017 3:07 PM
> To: edk2-devel@lists.01.org
> Cc: Fu, Siyuan <siyuan.fu@intel.com>; Wang, Fan <fan.wang@intel.com>; Ye,
> Ting <ting.ye@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
> Subject: [Patch 1/3] NetworkPkg/TcpDxe: Check FragmentBuffer for NULL
> before use
> 
> According the Spec, the FragmentBuffers in FragmentTable are allocated
> by the application when calling Receive() function. This patch is to
> check whether the FragmentBuffer is valid or not.
> 
> Cc: Fu Siyuan <siyuan.fu@intel.com>
> Cc: Wang Fan <fan.wang@intel.com>
> Cc: Ye Ting <ting.ye@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
> ---
>  NetworkPkg/TcpDxe/TcpMain.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/NetworkPkg/TcpDxe/TcpMain.c b/NetworkPkg/TcpDxe/TcpMain.c
> index fc3713e..e349d2d 100644
> --- a/NetworkPkg/TcpDxe/TcpMain.c
> +++ b/NetworkPkg/TcpDxe/TcpMain.c
> @@ -38,10 +38,13 @@ TcpChkDataBuf (
>    UINT32 Index;
> 
>    UINT32 Len;
> 
>    for (Index = 0, Len = 0; Index < FragmentCount; Index++) {
> +    if (FragmentTable[Index].FragmentBuffer == NULL) {
> +      return EFI_INVALID_PARAMETER;
> +    }
>      Len = Len + FragmentTable[Index].FragmentLength;
>    }
> 
>    if (DataLen != Len) {
>      return EFI_INVALID_PARAMETER;
> --
> 1.9.5.msysgit.1



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

* Re: [Patch 2/3] NetworkPkg/TcpDxe: Remove the redundant code.
  2017-12-22  7:07 ` [Patch 2/3] NetworkPkg/TcpDxe: Remove the redundant code Jiaxin Wu
@ 2017-12-22  7:18   ` Fu, Siyuan
  0 siblings, 0 replies; 5+ messages in thread
From: Fu, Siyuan @ 2017-12-22  7:18 UTC (permalink / raw)
  To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Ye, Ting, Wang, Fan, Wu, Jiaxin

Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>



> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Jiaxin Wu
> Sent: Friday, December 22, 2017 3:07 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting <ting.ye@intel.com>; Wang, Fan <fan.wang@intel.com>; Fu,
> Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
> Subject: [edk2] [Patch 2/3] NetworkPkg/TcpDxe: Remove the redundant code.
> 
> The function SockGroup() is not used by any other code. So,
> it can be deleted.
> 
> Cc: Fu Siyuan <siyuan.fu@intel.com>
> Cc: Wang Fan <fan.wang@intel.com>
> Cc: Ye Ting <ting.ye@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
> ---
>  NetworkPkg/TcpDxe/SockInterface.c | 46 ----------------------------------
> -----
>  NetworkPkg/TcpDxe/Socket.h        | 21 +-----------------
>  2 files changed, 1 insertion(+), 66 deletions(-)
> 
> diff --git a/NetworkPkg/TcpDxe/SockInterface.c
> b/NetworkPkg/TcpDxe/SockInterface.c
> index 0248cdf..0dfc0a7 100644
> --- a/NetworkPkg/TcpDxe/SockInterface.c
> +++ b/NetworkPkg/TcpDxe/SockInterface.c
> @@ -1078,56 +1078,10 @@ SockGetMode (
>  {
>    return Sock->ProtoHandler (Sock, SOCK_MODE, Mode);
>  }
> 
>  /**
> -  Configure the low level protocol to join a multicast group for
> -  this socket's connection.
> -
> -  @param[in]  Sock             Pointer to the socket of the connection to
> join the
> -                               specific multicast group.
> -  @param[in]  GroupInfo        Pointer to the multicast group info.
> -
> -  @retval EFI_SUCCESS          The configuration completed successfully.
> -  @retval EFI_ACCESS_DENIED    Failed to get the lock to access the
> socket.
> -  @retval EFI_NOT_STARTED      The socket is not configured.
> -
> -**/
> -EFI_STATUS
> -SockGroup (
> -  IN SOCKET *Sock,
> -  IN VOID   *GroupInfo
> -  )
> -{
> -  EFI_STATUS  Status;
> -
> -  Status = EfiAcquireLockOrFail (&(Sock->Lock));
> -
> -  if (EFI_ERROR (Status)) {
> -
> -    DEBUG (
> -      (EFI_D_ERROR,
> -      "SockGroup: Get the access for socket failed with %r",
> -      Status)
> -      );
> -
> -    return EFI_ACCESS_DENIED;
> -  }
> -
> -  if (SOCK_IS_UNCONFIGURED (Sock)) {
> -    Status = EFI_NOT_STARTED;
> -    goto Exit;
> -  }
> -
> -  Status = Sock->ProtoHandler (Sock, SOCK_GROUP, GroupInfo);
> -
> -Exit:
> -  EfiReleaseLock (&(Sock->Lock));
> -  return Status;
> -}
> -
> -/**
>    Add or remove route information in IP route table associated
>    with this socket.
> 
>    @param[in]  Sock             Pointer to the socket associated with the
> IP route
>                                 table to operate on.
> diff --git a/NetworkPkg/TcpDxe/Socket.h b/NetworkPkg/TcpDxe/Socket.h
> index f7f4a7a..26c5f4e 100644
> --- a/NetworkPkg/TcpDxe/Socket.h
> +++ b/NetworkPkg/TcpDxe/Socket.h
> @@ -1,9 +1,9 @@
>  /** @file
>    Common head file for TCP socket.
> 
> -  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
> 
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the
> BSD License
>    which accompanies this distribution.  The full text of the license may
> be found at
>    http://opensource.org/licenses/bsd-license.php.
> @@ -898,29 +898,10 @@ SockGetMode (
>    IN     SOCKET *Sock,
>    IN OUT VOID   *Mode
>    );
> 
>  /**
> -  Configure the low level protocol to join a multicast group for
> -  this socket's connection.
> -
> -  @param[in]  Sock             Pointer to the socket of the connection to
> join the
> -                               specific multicast group.
> -  @param[in]  GroupInfo        Pointer to the multicast group information.
> -
> -  @retval EFI_SUCCESS          The configuration completed successfully.
> -  @retval EFI_ACCESS_DENIED    Failed to get the lock to access the
> socket.
> -  @retval EFI_NOT_STARTED      The socket is not configured.
> -
> -**/
> -EFI_STATUS
> -SockGroup (
> -  IN SOCKET *Sock,
> -  IN VOID   *GroupInfo
> -  );
> -
> -/**
>    Add or remove route information in IP route table associated
>    with this socket.
> 
>    @param[in]  Sock             Pointer to the socket associated with the
> IP route
>                                 table to operate on.
> --
> 1.9.5.msysgit.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


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

end of thread, other threads:[~2017-12-22  7:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-22  7:07 [Patch 0/3] NetworkPkg/TcpDxe: Fix some issues in TcpDxe driver Jiaxin Wu
2017-12-22  7:07 ` [Patch 1/3] NetworkPkg/TcpDxe: Check FragmentBuffer for NULL before use Jiaxin Wu
2017-12-22  7:18   ` Fu, Siyuan
2017-12-22  7:07 ` [Patch 2/3] NetworkPkg/TcpDxe: Remove the redundant code Jiaxin Wu
2017-12-22  7:18   ` Fu, Siyuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox