summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-11-03 09:37:28 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-11-26 11:37:41 -0800
commitbb60c07c75a9087303779324be4e5de771a7687b (patch)
treeeb81ba990a69c6f00e5fee1dcfe17a5282cf3b4e /samples
parent0de578d014506a662b239708f4a0ded7e083292c (diff)
downloadlinux-3.10-bb60c07c75a9087303779324be4e5de771a7687b.tar.gz
linux-3.10-bb60c07c75a9087303779324be4e5de771a7687b.tar.bz2
linux-3.10-bb60c07c75a9087303779324be4e5de771a7687b.zip
cifs: fix potential buffer overrun in cifs.idmap handling code
commit 36960e440ccf94349c09fb944930d3bfe4bc473f upstream. The userspace cifs.idmap program generally works with the wbclient libs to generate binary SIDs in userspace. That program defines the struct that holds these values as having a max of 15 subauthorities. The kernel idmapping code however limits that value to 5. When the kernel copies those values around though, it doesn't sanity check the num_subauths value handed back from userspace or from the server. It's possible therefore for userspace to hand us back a bogus num_subauths value (or one that's valid, but greater than 5) that could cause the kernel to walk off the end of the cifs_sid->sub_auths array. Fix this by defining a new routine for copying sids and using that in all of the places that copy it. If we end up with a sid that's longer than expected then this approach will just lop off the "extra" subauths, but that's basically what the code does today already. Better approaches might be to fix this code to reject SIDs with >5 subauths, or fix it to handle the subauths array dynamically. At the same time, change the kernel to check the length of the data returned by userspace. If it's shorter than struct cifs_sid, reject it and return -EIO. If that happens we'll end up with fields that are basically uninitialized. Long term, it might make sense to redefine cifs_sid using a flexarray at the end, to allow for variable-length subauth lists, and teach the code to handle the case where the subauths array being passed in from userspace is shorter than 5 elements. Note too, that I don't consider this a security issue since you'd need a compromised cifs.idmap program. If you have that, you can do all sorts of nefarious stuff. Still, this is probably reasonable for stable. Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'samples')
0 files changed, 0 insertions, 0 deletions