From patchwork Mon Aug 5 02:21:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 170523 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp3668703ile; Sun, 4 Aug 2019 19:22:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqypAGW2x8Le1D6fRAJKJTCV6J5kaLUODILD0bEdLoes2+YiOzpj/Ao0KajF8m4qgd17Khfh X-Received: by 2002:aa7:8f2c:: with SMTP id y12mr73176367pfr.38.1564971758377; Sun, 04 Aug 2019 19:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564971758; cv=none; d=google.com; s=arc-20160816; b=D+6ck8rNTbXJDY7MsRziGVdbjm3s83U9yNDgNm7Xhk2CusSkR/wU8r/b3byLM9qJNr x6opr+Na9dE2BfyyLalAzD2CPYPKXK6ZQAs8/TgKgNxqDieJ45cNq+7IG7jAJLF60sRL gEQ0hvKVt7qjvCaHainTt4AmRIA1bXJEgCUlFosV/xSBFKIenuvmY06d4HcRCNdVxwRZ 9aARRuWaGYJXl3uMyabDw/VwagquFDFWoHRlX4hWKR9IsGvCywoZnJxF3F6v5dsZ/l5l 6GeFhF+Tcaa8V4/AhJqqAlGMdQlgGFOiPeLawTRtwMJzLQ37QGvv9VlBk1uRpT3nGLpn BNog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=TbK6VAq503EXh72UIZZuMWC50YcF7dIdIDwOWGY2OTM=; b=KUcXwngg5IyBn+P20o6zMI8ctrG9TG8g8KZEshBUAbguV1PWnVq6NAI3aPs59Wd9yD sMVq+6jn6wi9fC3DJtPNDrx++syghtXSpPNcS/ChFCzB+AwfbBenER0Dz/su2WvbG3mv J9WsHTpSg82axP7ZJOJQUbqGslTQLOkLMTsy1BlKPgjq7c3uZZG3nZgKIz8P9/ZdXaZC jjl0NoJmmQDuF6FXbl0BDqtT868U/OM1KLjh2eDCMdyyb3MGZRSqBEHCQx3/A7pNuNzW M8TGG0f/8Wcg81geoAZOaRM1J/7hloT6gqtVvIc7pYz8CxA5M7jsdAbM/spLqPkLe9HL w1IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=NauSU16L; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 11si40220721pla.248.2019.08.04.19.22.36; Sun, 04 Aug 2019 19:22:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@nifty.com header.s=dec2015msa header.b=NauSU16L; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726766AbfHECWf (ORCPT + 14 others); Sun, 4 Aug 2019 22:22:35 -0400 Received: from conuserg-11.nifty.com ([210.131.2.78]:64913 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726757AbfHECWf (ORCPT ); Sun, 4 Aug 2019 22:22:35 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id x752M7pW025642; Mon, 5 Aug 2019 11:22:07 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com x752M7pW025642 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1564971727; bh=TbK6VAq503EXh72UIZZuMWC50YcF7dIdIDwOWGY2OTM=; h=From:To:Cc:Subject:Date:From; b=NauSU16L91uGEVC0RMjF/rt4fU0xPLH+c/bhjoLq3uqc8PL0pBz92uV8vb/rkNSZP QDgiALzJQh881aARtRB0xhbN7kBH9bwpGmuhDl6RLEM+GHgnXMneLfEnp6oULs0gSk S6PGj8ZRAIf9MlUL9CS5H1DYTWbCoM/0wncnTZzc6L+mgxr3tmzpyjXUHlQMXQSSfa PmUQhNRKYQ1XPorKgssGJOrTJwXpMWbBu7u4cvE4mRXLKAQdSB1qQHA5WYQ8D/t654 sQ5pbLQy5IQNpakLxTXF1ZC5df5SErqG2ufY6VGFrHIgaQ1RMz2YwzmiMnSeKFBedi jwQPe+d1y7Hfw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: Greg KH , Sasha Levin , linux-stable Cc: Masahiro Yamada , Masahiro Yamada , "M. Vefa Bicakci" Subject: [PATCH 4.19.x] kconfig: Clear "written" flag to avoid data loss Date: Mon, 5 Aug 2019 11:21:43 +0900 Message-Id: <20190805022143.8657-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: "M. Vefa Bicakci" commit 0c5b6c28ed68becb692b43eae5e44d5aa7e160ce upstream. Prior to this commit, starting nconfig, xconfig or gconfig, and saving the .config file more than once caused data loss, where a .config file that contained only comments would be written to disk starting from the second save operation. This bug manifests itself because the SYMBOL_WRITTEN flag is never cleared after the first call to conf_write, and subsequent calls to conf_write then skip all of the configuration symbols due to the SYMBOL_WRITTEN flag being set. This commit resolves this issue by clearing the SYMBOL_WRITTEN flag from all symbols before conf_write returns. Fixes: 8e2442a5f86e ("kconfig: fix missing choice values in auto.conf") Cc: linux-stable # 4.19+ Signed-off-by: M. Vefa Bicakci Signed-off-by: Masahiro Yamada --- scripts/kconfig/confdata.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.17.1 diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index fd99ae90a618..0dde19cf7486 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -784,6 +784,7 @@ int conf_write(const char *name) const char *str; char dirname[PATH_MAX+1], tmpname[PATH_MAX+22], newname[PATH_MAX+8]; char *env; + int i; dirname[0] = 0; if (name && name[0]) { @@ -860,6 +861,9 @@ int conf_write(const char *name) } fclose(out); + for_all_symbols(i, sym) + sym->flags &= ~SYMBOL_WRITTEN; + if (*tmpname) { strcat(dirname, basename); strcat(dirname, ".old");