public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org,
	Arjan van de Ven <arjan@infradead.org>
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	jakub@redhat.com, security@kernel.org, mingo@elte.hu,
	davem@davemloft.net, Arjan van de Ven <arjan@linux.intel.com>
Subject: [patch 7/9] net: Make the copy length in af_packet sockopt handler unsigned
Date: Thu, 01 Oct 2009 16:16:40 -0700	[thread overview]
Message-ID: <20091001231805.475593743@mini.kroah.org> (raw)
In-Reply-To: <20091001231938.GA29593@kroah.com>

[-- Attachment #1: net-make-the-copy-length-in-af_packet-sockopt-handler-unsigned.patch --]
[-- Type: text/plain, Size: 1361 bytes --]


2.6.27-stable review patch.  If anyone has any objections, please let us know.

------------------

From: Arjan van de Ven <arjan@linux.intel.com>

fixed upstream in commit b7058842c940ad2c08dd829b21e5c92ebe3b8758 in a different way

The length of the to-copy data structure is currently stored in
a signed integer. However many comparisons are done with sizeof(..)
which is unsigned. It's more suitable for this variable to be unsigned
to make these comparisons more naturally right.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 net/packet/af_packet.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1500,7 +1500,7 @@ packet_setsockopt(struct socket *sock, i
 static int packet_getsockopt(struct socket *sock, int level, int optname,
 			     char __user *optval, int __user *optlen)
 {
-	int len;
+	unsigned int len;
 	int val;
 	struct sock *sk = sock->sk;
 	struct packet_sock *po = pkt_sk(sk);
@@ -1513,7 +1513,7 @@ static int packet_getsockopt(struct sock
 	if (get_user(len, optlen))
 		return -EFAULT;
 
-	if (len < 0)
+	if ((int)len < 0)
 		return -EINVAL;
 
 	switch(optname)	{



  parent reply	other threads:[~2009-10-01 23:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-01 23:19 [patch 0/9] 2.6.27.36-stable review Greg KH
2009-10-01 23:16 ` Greg KH
2009-10-01 23:16 ` [patch 1/9] fs: make sure data stored into inode is properly seen before unlocking new inode Greg KH
2009-10-01 23:16 ` [patch 2/9] p54usb: add Zcomax XG-705A usbid Greg KH
2009-10-01 23:16 ` [patch 3/9] enc28j60: fix RX buffer overflow Greg KH
2009-10-01 23:16 ` [patch 4/9] pcnet_cs: Fix misuse of the equality operator Greg KH
2009-10-01 23:16 ` [patch 5/9] Fix incorrect stable backport to bas_gigaset Greg KH
2009-10-01 23:16 ` [patch 6/9] net ax25: Fix signed comparison in the sockopt handler Greg KH
2009-10-01 23:16 ` Greg KH [this message]
2009-10-01 23:16 ` [patch 8/9] netfilter: bridge: refcount fix Greg KH
2009-10-01 23:16 ` [patch 9/9] hugetlb: restore interleaving of bootmem huge pages (2.6.31) Greg KH
2009-10-02 17:49 ` [patch 10/09] mm: fix anonymous dirtying Greg KH
2009-10-02 17:50 ` [patch 11/09] mmap: avoid unnecessary anon_vma lock acquisition in vma_adjust() Greg KH
2009-10-02 17:50 ` [patch 0/9] 2.6.27.36-stable review Greg KH

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=20091001231805.475593743@mini.kroah.org \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arjan@infradead.org \
    --cc=arjan@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=jakub@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=security@kernel.org \
    --cc=stable-review@kernel.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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