platform/surface: aggregator: prevent information leak in ssam_cdev_request()
Subsystems (4)
PATCH 1/1 platform/surface: aggregator: prevent information leak in ssam_cdev_request()
If copy_struct_from_user() fails at the start of the function then this function calls put_user(rsp.length, &r->response.length) before "rsp.length" is set to zero. That is a potential security issue because it discloses kernel stack data to user space.
--- drivers/platform/surface/surface_aggregator_cdev.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/platform/surface/surface_aggregator_cdev.c +1 -3
@@ -67,7 +67,7 @@ static long ssam_cdev_request(struct ssam_cdev *cdev, unsigned long arg)struct ssam_cdev_request __user *r;struct ssam_cdev_request rqst;struct ssam_request spec; -struct ssam_response rsp; +struct ssam_response rsp = {};const void __user *plddata;void __user *rspdata;int status =0 , ret =0 , tmp;
@@ -96,8 +96,6 @@ static long ssam_cdev_request(struct ssam_cdev *cdev, unsigned long arg) spec.flags |=SSAM_REQUEST_UNSEQUENCED ; rsp.capacity = rqst.response.length; - rsp.length =0 ; - rsp.pointer =NULL ;/* Get request payload from user-space. */ if (spec.length) {
Signature · 1 line
2.29.2
Hi,
Quoted 7 lines · Dan Carpenter
If
copy_struct_from_user()fails at the start of the function then this function callsput_user(rsp.length, &r->response.length)before "rsp.length" is set to zero. That is a potential security issue because it discloses kernel stack data to user space.Fixes 178f6ab77e61 ("platform/surface: Add Surface Aggregator user-space interface")Signed-off-by Dan Carpenter <[email protected]>
Thank you for your patch, another fix for this was already submitted:
https://patchwork.kernel.org/project/platform-driver-x86/patch/[email protected]/
So I'm dropping this patch from my queue.
Regards,
Hans
Quoted 27 lines
--- drivers/platform/surface/surface_aggregator_cdev.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/platform/surface/surface_aggregator_cdev.c +1
-3@@ -67,7 +67,7 @@ static long ssam_cdev_request(struct ssam_cdev *cdev, unsigned long arg)struct ssam_cdev_request __user *r;struct ssam_cdev_request rqst;struct ssam_request spec; -struct ssam_response rsp; +struct ssam_response rsp = {};const void __user *plddata;void __user *rspdata;int status =0 , ret =0 , tmp;@@ -96,8 +96,6 @@ static long ssam_cdev_request(struct ssam_cdev *cdev, unsigned long arg) spec.flags |=SSAM_REQUEST_UNSEQUENCED ; rsp.capacity = rqst.response.length; - rsp.length =0 ; - rsp.pointer =NULL ;/* Get request payload from user-space. */ if (spec.length) {