From patchwork Wed May 14 12:57:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 4174571 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 94179BFF02 for ; Wed, 14 May 2014 12:58:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CBC2F20364 for ; Wed, 14 May 2014 12:58:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA2632017D for ; Wed, 14 May 2014 12:58:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751674AbaENM6P (ORCPT ); Wed, 14 May 2014 08:58:15 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:27047 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751331AbaENM6P (ORCPT ); Wed, 14 May 2014 08:58:15 -0400 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s4ECw3or013378 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 14 May 2014 12:58:03 GMT Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s4ECw1rV010512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 14 May 2014 12:58:02 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userz7022.oracle.com (8.14.5+Sun/8.14.4) with ESMTP id s4ECw09q023664; Wed, 14 May 2014 12:58:00 GMT Received: from mwanda (/197.157.0.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 14 May 2014 05:57:59 -0700 Date: Wed, 14 May 2014 15:57:20 +0300 From: Dan Carpenter To: "Rafael J. Wysocki" , Fabian Frederick Cc: Len Brown , Pavel Machek , linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] PM / hibernate: memory corruption in resumedelay_setup() Message-ID: <20140514125720.GC14571@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP "resume_delay" is not an unsigned long, it's an int, so this will corrupt memory on 64 bit systems. Fixes: 317cf7e5e85e ('PM / hibernate: convert simple_strtoul to kstrtoul') Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 2377ff7..3659b26 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c @@ -1115,8 +1115,9 @@ static int __init resumewait_setup(char *str) static int __init resumedelay_setup(char *str) { - int rc = kstrtoul(str, 0, (unsigned long *)&resume_delay); + int rc; + rc = kstrtoint(str, 0, &resume_delay); if (rc) return rc; return 1;