net: sock: validate data_len before allocating skb in sock_alloc_send_pskb()
authorJason Wang <jasowang@redhat.com>
Wed, 30 May 2012 21:18:10 +0000 (21:18 +0000)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Fri, 5 Apr 2013 06:12:58 +0000 (09:12 +0300)
commite35328b76880f22ac97e8ba5c3b186df17ff817a
treeb394c6fee07db32dee86ef56a1c243a6d6cfce11
parent4856b6e009d7c63d41fba260320fbf888b58c30d
net: sock: validate data_len before allocating skb in sock_alloc_send_pskb()

[ Upstream commit cc9b17ad29ecaa20bfe426a8d4dbfb94b13ff1cc ]

We need to validate the number of pages consumed by data_len, otherwise frags
array could be overflowed by userspace. So this patch validate data_len and
return -EMSGSIZE when data_len may occupies more frags than MAX_SKB_FRAGS.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/core/sock.c