Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2312675ybd; Thu, 27 Jun 2019 10:13:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqz2N5Ouw3qyUaCKy/8zX+QHOkvgmRAZV+60RijFreIEwJXSUwXlGgjXePSjs6JjV1NQhCjs X-Received: by 2002:a17:902:bd0a:: with SMTP id p10mr5935178pls.134.1561655601287; Thu, 27 Jun 2019 10:13:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561655601; cv=none; d=google.com; s=arc-20160816; b=R50VbVeWe4B+u0VzB+7ohOVa1ZiSexOmu2Xdv/eFRDiMmdbpmnRWOhDFQF0VxwmZsU xrLIx71oZLHrzgTpKLQvbmu1XLzOgNaGIsuy3Wkzn69rPDVsXeW2dxHFDjjUkM//keFX DWUX5yUd8WPCD/ke7KEugxYL9RdEHLWUGak6w+rc25+GpA6e9d2mcGG0EGOKkodWbsYw ISSQ0piooOwIkG9X/TcEoIhIwywnDiai63fzPQT1SLKyMcFXAXYPaLFL29f0y1AGpWVj BL5rlPdFmS8I8zYC3Qu0FBHXLdKDAzvNW73h1aZ/XIFLyxeu1W8Hs1nkU5cegK7HJmeW eUvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:cc:from:references:to:subject; bh=SYHq9izf7gIau9w8Vl5KvZShUhMIm2r7GhQjBoRY9GQ=; b=cM7MS8ZvDhHMpKZ1jtKT9ACguVZQVkqplsKp2nToirBYI7kJ8cMbXfz+XNLdF6qP6R nCz/N1pB0XFVJAwtABR4LfwE7x10/TPakU6aq7/osU7m8Tntflne/GicOjwD93wF+haD EfJBSX9ZbUZitlI+k1iENmuNBDx6FR0q0DeOtQZTB2TFFGREl97jjs66Al0f4ImfXRsw Mut8Ubbtvx3Bok2Gl+x6ri31n8EK8BE09YfbvZiDIqWvAb319w/1nFgwbP3Wfk0w6NIp PIL9Uuly4xhtWxkAdNZwF2Idk18ZPRrpchh9TB0jC0lBfKZUo9TfbBkZCfo+r9a/FHIK Xabw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 2si2821259pla.22.2019.06.27.10.13.04; Thu, 27 Jun 2019 10:13:21 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726540AbfF0RLW (ORCPT + 99 others); Thu, 27 Jun 2019 13:11:22 -0400 Received: from foss.arm.com ([217.140.110.172]:59128 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726315AbfF0RLV (ORCPT ); Thu, 27 Jun 2019 13:11:21 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1A6CC360; Thu, 27 Jun 2019 10:11:21 -0700 (PDT) Received: from [10.1.196.105] (eglon.cambridge.arm.com [10.1.196.105]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4C0733F718; Thu, 27 Jun 2019 10:11:20 -0700 (PDT) Subject: Re: [PATCH] EDAC: Fix global-out-of-bounds write when setting edac_mc_poll_msec To: Eiichi Tsukata References: <20190626054011.30044-1-devel@etsukata.com> From: James Morse Cc: bp@alien8.de, mchehab@kernel.org, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, Tony Luck Message-ID: Date: Thu, 27 Jun 2019 18:11:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190626054011.30044-1-devel@etsukata.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, (CC: +Tony Luck. Original Patch: lore.kernel.org/r/20190626054011.30044-1-devel@etsukata.com ) On 26/06/2019 06:40, Eiichi Tsukata wrote: > Commit 9da21b1509d8 ("EDAC: Poll timeout cannot be zero, p2") assumes > edac_mc_poll_msec to be unsigned long, but the type of the variable still > remained as int. Setting edac_mc_poll_msec can trigger out-of-bounds > write. Thanks for catching this! > Fix it by changing the type of edac_mc_poll_msec to unsigned int. This means reverting more of 9da21b1509d8, but it also fixes signed/unsigned issues: | root@debian-guest:/sys/module/edac_core/parameters# echo 4294967295 > edac_mc_poll_msec | root@debian-guest:/sys/module/edac_core/parameters# cat edac_mc_poll_msec | -1 | root@debian-guest:/sys/module/edac_core/parameters# echo -1 > edac_mc_poll_msec | -bash: echo: write error: Invalid argument > The reason why this patch adopts unsigned int rather than unsigned long > is msecs_to_jiffies() assumes arg to be unsigned int. Ah, so the range is limited anyway. It looks like it was switched to long to be consistent with edac_mc_workq_setup(), which has since been removed in preference to msecs_to_jiffies(). Reviewed-by: James Morse Thanks, James