[xenial/master-next,1/1] UBUNTU: SAUCE: net: ipv4: fix for a race condition in raw_sendmsg -- fix backport

Message ID 20180212192102.14974-2-apw@canonical.com
State New
Headers show
Series
  • [xenial/master-next,1/1] UBUNTU: SAUCE: net: ipv4: fix for a race condition in raw_sendmsg -- fix backport
Related show

Commit Message

Andy Whitcroft Feb. 12, 2018, 7:21 p.m.
Fix a miss-backport of the upstream commit.

Fixes: 63da13a92f24 ("net: ipv4: fix for a race condition in raw_sendmsg -- fix backport")
BugLink: http://bugs.launchpad.net/bugs/1748671
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 net/ipv4/raw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Khaled Elmously Feb. 12, 2018, 7:53 p.m. | #1
Nice catch

Acked-by: Khalid Elmously <khalid.elmously@canonical.com>


On 2018-02-12 19:21:02 , Andy Whitcroft wrote:
> Fix a miss-backport of the upstream commit.
> 
> Fixes: 63da13a92f24 ("net: ipv4: fix for a race condition in raw_sendmsg -- fix backport")
> BugLink: http://bugs.launchpad.net/bugs/1748671
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
> ---
>  net/ipv4/raw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
> index 83a609bc7c57..3b764c0c1fec 100644
> --- a/net/ipv4/raw.c
> +++ b/net/ipv4/raw.c
> @@ -621,7 +621,7 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
>  			goto done;
>  	}
>  
> -	if (hdrincl) {
> +	if (!hdrincl) {
>  		rfv.msg = msg;
>  		rfv.hlen = 0;
>  
> -- 
> 2.15.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Patch

diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 83a609bc7c57..3b764c0c1fec 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -621,7 +621,7 @@  static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 			goto done;
 	}
 
-	if (hdrincl) {
+	if (!hdrincl) {
 		rfv.msg = msg;
 		rfv.hlen = 0;