]> git.baikalelectronics.ru Git - kernel.git/commit
RDS: Let rds_message_alloc_sgs() return NULL
authorAndy Grover <andy.grover@oracle.com>
Thu, 28 Oct 2010 15:40:59 +0000 (15:40 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 30 Oct 2010 23:34:18 +0000 (16:34 -0700)
commit2e13a7a729a82e900bac144aaa6d86e961d059dd
tree0ba63235a10b7640bc8b613da0d0cda220a55087
parentd1fbee8b9248162e98a925cc3d5bf1f91aaecc92
RDS: Let rds_message_alloc_sgs() return NULL

Even with the previous fix, we still are reading the iovecs once
to determine SGs needed, and then again later on. Preallocating
space for sg lists as part of rds_message seemed like a good idea
but it might be better to not do this. While working to redo that
code, this patch attempts to protect against userspace rewriting
the rds_iovec array between the first and second accesses.

The consequences of this would be either a too-small or too-large
sg list array. Too large is not an issue. This patch changes all
callers of message_alloc_sgs to handle running out of preallocated
sgs, and fail gracefully.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rds/message.c
net/rds/rdma.c
net/rds/send.c