Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp137870ybl; Tue, 7 Jan 2020 15:46:46 -0800 (PST) X-Google-Smtp-Source: APXvYqzqzsopJNBWDkHrZXktFuTunRoMnHjhih1Jq3+OeW03fWDHoLwa0pn7AS35S+R4PHwccy09 X-Received: by 2002:a05:6808:64d:: with SMTP id z13mr870117oih.104.1578440806026; Tue, 07 Jan 2020 15:46:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578440806; cv=none; d=google.com; s=arc-20160816; b=rHCICDhgV1Gzim+HboBOzv+WmAyyPCGgxcB3/uKPA1Zm0lAhYvicGxoNHdepQgYihI u4MsZoefdxOh9Dd+WfkSmbzcnJx4hNMtCZ96b5FknO20lwnqJDi5dmd9RU80U2T6eqYL 3kIXTT/e84WLhLDfjKYLKK4GhdF5c0t+Zw/wcKcGk0oJb84X96iMgpZp8qcmdMAmVqmS D4Ek3h9BX5Ml94adIfVN3K1BafZF4jbD0eptFJhayCkHctgS8xQRpgR8CGdiqMkuX0q9 OTs4kEuaf5lM8up5vpBQwHUd6jq+sTtGDCZrrVZlOiu8vxNlVwggu9xQXjTeikjMabiT yKeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:ironport-sdr :dkim-signature; bh=NHm42TlJLKDMXwfLCWbPw7bKb/s9QHjU3lyklyyG0cI=; b=kODOT4xRuyD9fSC8LGYHkcq2ta/GhAORqwsU1XrEM1v6o57NkA0UKM24JQ4Im3ox79 gTiUEkJTAhp+AC1eMEhfifMg7Cgm98dSyOdjQD9X8Ib1MxDJ2+vGKttykaRTE51frcAg V0MmdS8G8lzRf71ZODsxhhYratdhDrXUJxfKwMlAxXdhrj7ET4oiChbR0hPowDFgkwPJ eC67BYf3+sJIM3ldIlaSAxgKoNAD+vYUsx0pQkJJhF8saVCjDKQeI19VpbgL6upYiOuB c3SS9CAM4/C1lBgPhaeout4pnrvHjvbqzS9eRTsLQsWmiwOu7nZgLduWGeGjHIr4VCCV gruQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b="EI/EFyjf"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si817473otp.124.2020.01.07.15.46.34; Tue, 07 Jan 2020 15:46:46 -0800 (PST) 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=@amazon.com header.s=amazon201209 header.b="EI/EFyjf"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727400AbgAGXps (ORCPT + 99 others); Tue, 7 Jan 2020 18:45:48 -0500 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]:60707 "EHLO smtp-fw-2101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726470AbgAGXpr (ORCPT ); Tue, 7 Jan 2020 18:45:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1578440746; x=1609976746; h=date:from:to:cc:subject:message-id:mime-version; bh=NHm42TlJLKDMXwfLCWbPw7bKb/s9QHjU3lyklyyG0cI=; b=EI/EFyjfG0QSvSKGZQrLy3ruBsZhASNC7DTJtlviSuSDbYOtly12AUGQ 5L3IEuk90suW/RQUiQv6N9mwmLK4S7dWb2eM4wtz9BgeV1RR+X92Uapdt 0vm/LJesemandrsGUNnOTUX7/QroFH52cRO0Wk7RtFPy6OEK0670o9/uO I=; IronPort-SDR: gkNYw935e97eoztM5ARiz4jflA1dZJd8BbTSLZxwZdbg2Lz2qjmfDCPJWMmvzfDoR8KoPOg4GN Ps++MVqJl7vA== X-IronPort-AV: E=Sophos;i="5.69,407,1571702400"; d="scan'208";a="11408855" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1d-f273de60.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP; 07 Jan 2020 23:45:46 +0000 Received: from EX13MTAUEB002.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1d-f273de60.us-east-1.amazon.com (Postfix) with ESMTPS id D093FA2715; Tue, 7 Jan 2020 23:45:38 +0000 (UTC) Received: from EX13D08UEB001.ant.amazon.com (10.43.60.245) by EX13MTAUEB002.ant.amazon.com (10.43.60.12) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 7 Jan 2020 23:44:58 +0000 Received: from EX13MTAUEA001.ant.amazon.com (10.43.61.82) by EX13D08UEB001.ant.amazon.com (10.43.60.245) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 7 Jan 2020 23:44:57 +0000 Received: from dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (172.22.96.68) by mail-relay.amazon.com (10.43.61.243) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Tue, 7 Jan 2020 23:44:57 +0000 Received: by dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (Postfix, from userid 4335130) id 9A92F40E65; Tue, 7 Jan 2020 23:44:57 +0000 (UTC) Date: Tue, 7 Jan 2020 23:44:57 +0000 From: Anchal Agarwal To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [RFC PATCH V2 10/11] PM / hibernate: update the resume offset on SNAPSHOT_SET_SWAP_AREA Message-ID: <20200107234457.GA18829@dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aleksei Besogonov The SNAPSHOT_SET_SWAP_AREA is supposed to be used to set the hibernation offset on a running kernel to enable hibernating to a swap file. However, it doesn't actually update the swsusp_resume_block variable. As a result, the hibernation fails at the last step (after all the data is written out) in the validation of the swap signature in mark_swapfiles(). Before this patch, the command line processing was the only place where swsusp_resume_block was set. Signed-off-by: Aleksei Besogonov Signed-off-by: Munehisa Kamata Signed-off-by: Anchal Agarwal --- kernel/power/user.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/power/user.c b/kernel/power/user.c index 77438954cc2b..d396e313cb7b 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c @@ -374,8 +374,12 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd, if (swdev) { offset = swap_area.offset; data->swap = swap_type_of(swdev, offset, NULL); - if (data->swap < 0) + if (data->swap < 0) { error = -ENODEV; + } else { + swsusp_resume_device = swdev; + swsusp_resume_block = offset; + } } else { data->swap = -1; error = -EINVAL; -- 2.15.3.AMZN