Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp921704yba; Thu, 4 Apr 2019 00:07:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFc0wxWGg0So4wn/C72YW0m6wNZHWbqy3gTKFXuBo5wtdXOfGi15D2pSerd12nVvMnThpy X-Received: by 2002:a63:c10b:: with SMTP id w11mr4197021pgf.39.1554361670822; Thu, 04 Apr 2019 00:07:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554361670; cv=none; d=google.com; s=arc-20160816; b=M7J2XW/EHVh4ooaZNXnoK3FIS0pYf8Xjj7wZwC4kl26sq7jTqXGUDUfcxuYQKr4Mfe pBzOnGokRTPNf6i4hEi9s6LZI06GW6h4z0gJVUFilIt07d7vjmT1R+IvBaa+jA+3a0l3 8K35kkAKiv66MaKpvPjtOIa40bAZKayKFNCFQTO9rn6ZhkSQWo8FeLuIJ2nZa8EwU6T4 uUR/23eOzwU8F0xiATXqffc2QfGPrETU5AUGYom0eVO72AJsmDciYS/bpa++v7XbIYjC Han9XHq92EzGHezEskUTsPX4A0uQvUV1X43lZkxHPYfwpXJ418iNjyuum4mekjkJZ9eX ceDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:in-reply-to :subject:cc:to:from:user-agent:references:dkim-signature; bh=gIu1x+mW1ir5iF7JpPsqOImZuIQnF/0zUJnFMQ0zgOI=; b=UN8yMXEQMVeRq4QZvXXQ3cEfQm2DlMPPlpZWLLXefrSyGDCCLOniNEKiiqPa1FUhGf SjzVCOi2x+UuPmusuXw2Iz1DRXPsu1nNetdaQ7UCLukS88so+a3Yg1VXUtDFoKIlrQdc i0hmWtQeyyyn4CGTg9WXf4jwmlydL8OBoYy5ygLjygZyrOL9mNxAipE5TX9TMAvi+gXm 0ZB9dJCxtM4W+WtFj7oapJxmgMMRIIFfENFVXcZFDOqbsBGPnKRtgq7xxf5XSS3QZ3xX 51KSgzacWkWK/zvYnScntCxwipceR3sIhVKHg3wT7HDWFptAmeW9NxHFO5JmS6nan/Yi 6pWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XvEDaAMb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h20si10755064pgn.69.2019.04.04.00.07.35; Thu, 04 Apr 2019 00:07:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XvEDaAMb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727108AbfDDHHB (ORCPT + 99 others); Thu, 4 Apr 2019 03:07:01 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:46092 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726222AbfDDHG7 (ORCPT ); Thu, 4 Apr 2019 03:06:59 -0400 Received: by mail-pl1-f193.google.com with SMTP id y6so675401pll.13 for ; Thu, 04 Apr 2019 00:06:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=gIu1x+mW1ir5iF7JpPsqOImZuIQnF/0zUJnFMQ0zgOI=; b=XvEDaAMb+Nu/iRu6vQJ4RSQqxMHTmPSawG6QOLFPl/skcZekhRuvQJ0c4y8uLKaUlQ KAp2hR6Xm8dvSN30W1Rp0TBywBTWiM8FIiTRqLoSgjrPT3cSAOhHMYKR59nkDnj9ld3j 8ATdxGVDrkElsvvgKx/kRPxX6DUCLLpyhYLMLxN4JDCb8LnnOndX+DqdkmgNZ1F6VgUj yfcMnH2jlVbpz73gdTz9BOBVks+gM0sSleCiWIrN4qnHY1LR+CjUM2BlhjpCJW9V5ZdG 9NZ+yppdR72MJo+yS3lGwAXLF5ZX3LOjoz9xgISgjenTfK8BvBynqOb0FuuZxuyxD0HL eZpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=gIu1x+mW1ir5iF7JpPsqOImZuIQnF/0zUJnFMQ0zgOI=; b=Fh8LFAY/6YNVwtpt2h68QoaCOsd6QAcAmZnPfU/IEJ19cwoi30ZxdepYeHhVMd8kbF 5V4Z9lOLWTnqDDaARmM9UQvGs0l3CHGu8iZcuob3xDsaOC0jxe89AVMMlbcfjJ3pyVq2 XaqIJBYAb9M1CZTN+KTnsH8BsuHu9K3wiqMype1AZAzlM8bCiBWgKtkJIDHDQGLhrbbZ vxqmMocMVE7SV+LZd3fxPw2lciPpglgrFmpGT9B1KlH35zI9WL0TOvphJF4tcrEopMV1 KmUICzVw+tNyVkGLghr5bwCd28b1HeJEegqdtRveUxJwmRBuM0EJjNjZFHnXmLsCWcab K2+Q== X-Gm-Message-State: APjAAAWtLcA5RnUz6WHMe2JJNKZqsH/k0XQPl9Cfl6bolvhNBr49aRQJ ED89iCTftfyKqUPCZZQLMCakfQ== X-Received: by 2002:a17:902:768c:: with SMTP id m12mr4670072pll.160.1554361618828; Thu, 04 Apr 2019 00:06:58 -0700 (PDT) Received: from arch-late ([147.50.13.10]) by smtp.gmail.com with ESMTPSA id 17sm36102624pfw.65.2019.04.04.00.06.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Apr 2019 00:06:58 -0700 (PDT) References: <20190404065330.12382-1-johan@kernel.org> User-agent: mu4e 1.0; emacs 27.0.50 From: Rui Miguel Silva To: Johan Hovold Cc: Alex Elder , Greg Kroah-Hartman , greybus-dev@lists.linaro.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , stable Subject: Re: [PATCH] staging: greybus: power_supply: fix prop-descriptor request size In-reply-to: <20190404065330.12382-1-johan@kernel.org> Date: Thu, 04 Apr 2019 08:06:53 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; format=flowed Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Johan, Thanks for the patch. On Thu 04 Apr 2019 at 07:53, Johan Hovold wrote: > Since moving the message buffers off the stack, the dynamically > allocated get-prop-descriptor request buffer is incorrectly > sized due to > using the pointer rather than request-struct size when creating > the > operation. > > Fortunately, the pointer size is always larger than this > one-byte > request, but this could still cause trouble on the remote end > due to the > unexpected message size. > > Fixes: 9d15134d067e ("greybus: power_supply: rework get > descriptors") > Cc: stable # 4.9 > Cc: Rui Miguel Silva > Signed-off-by: Johan Hovold Nice catch. LGTM. Reviewed-by: Rui Miguel Silva --- Cheers, Rui > --- > drivers/staging/greybus/power_supply.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/greybus/power_supply.c > b/drivers/staging/greybus/power_supply.c > index 0529e5628c24..ae5c0285a942 100644 > --- a/drivers/staging/greybus/power_supply.c > +++ b/drivers/staging/greybus/power_supply.c > @@ -520,7 +520,7 @@ static int > gb_power_supply_prop_descriptors_get(struct gb_power_supply > *gbpsy) > > op = gb_operation_create(connection, > GB_POWER_SUPPLY_TYPE_GET_PROP_DESCRIPTORS, > - sizeof(req), sizeof(*resp) + > props_count * > + sizeof(*req), sizeof(*resp) + > props_count * > sizeof(struct > gb_power_supply_props_desc), > GFP_KERNEL); > if (!op)