linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: mjurczyk@google.com
Cc: jwi@linux.vnet.ibm.com, ubraun@linux.vnet.ibm.com,
	linux-s390@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] af_iucv: Move sockaddr length checks to before accessing sa_family in bind and connect handlers
Date: Tue, 13 Jun 2017 16:15:42 -0400 (EDT)	[thread overview]
Message-ID: <20170613.161542.837461878998748762.davem@davemloft.net> (raw)
In-Reply-To: <20170613174228.9218-1-mjurczyk@google.com>

From: Mateusz Jurczyk <mjurczyk@google.com>
Date: Tue, 13 Jun 2017 19:42:28 +0200

> Verify that the caller-provided sockaddr structure is large enough to
> contain the sa_family field, before accessing it in bind() and connect()
> handlers of the AF_IUCV socket. Since neither syscall enforces a minimum
> size of the corresponding memory region, very short sockaddrs (zero or
> one byte long) result in operating on uninitialized memory while
> referencing .sa_family.
> 
> Signed-off-by: Mateusz Jurczyk <mjurczyk@google.com>
...
>  	/* Verify the input sockaddr */
> -	if (!addr || addr->sa_family != AF_IUCV)
> -		return -EINVAL;
> -
> -	if (addr_len < sizeof(struct sockaddr_iucv))
> +	if (!addr || addr_len < sizeof(struct sockaddr_iucv) ||
> +	    addr->sa_family != AF_IUCV)

The 'addr' can never be NULL so please remove that check, thank you.

  reply	other threads:[~2017-06-13 20:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-13 17:42 [PATCH] af_iucv: Move sockaddr length checks to before accessing sa_family in bind and connect handlers Mateusz Jurczyk
2017-06-13 20:15 ` David Miller [this message]
2017-06-14 14:49 ` Julian Wiedmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170613.161542.837461878998748762.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=jwi@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjurczyk@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=ubraun@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).