Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2748252ybh; Mon, 5 Aug 2019 06:14:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhcW+ycX47rP3AwG43mEjFQwEi2oIvoa8fXN1ZUee65rrsxI5U2/tx/V0IFJ6CHk0CEZxp X-Received: by 2002:a17:90a:de02:: with SMTP id m2mr18148420pjv.18.1565010872177; Mon, 05 Aug 2019 06:14:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565010872; cv=none; d=google.com; s=arc-20160816; b=gjL682fsmQyZ6HCYfpymB+pBnpBSbaLE+2pF2pHyVk1IIJtQ6u3r8t1+/qjS/kEfXx zYBsVCl3MpeykYZtOa9AK6LKcNjqjKKC2sPa+haJcgs/dqZKSXY8RCHUyTx2HzBL0oLl lB6hxfLCfJMFtahePW8s54nxTdC5W/1fGPIe5r1UVJltP1Snkw8mrCqQ2wOfKsSI234g CZ88h8iI7GHzMpBViDFnBhyQFrpIaq4H4AR40TRZ+3P+Ahp/V7LqGMVDq7oaXJH2xLl/ fQCcZMml6CfOxNrGfm4ZGNeNdCSx7YALAj8ZLcXGyze5QuJ2vfpm7xq0X7+RQs+sAtN7 G2YA== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Wv7n10007sG44qcl6HvvOB5V5ewo0Sy4SFwFkWa1JGI=; b=hmY36WE961x8cbGhrCRsfU4U7UCWf+6x93YbOUYIn1n1SwWkdrM6zS/zBI9b+p6HMM b0qSnXsNQRUHVWzX/FKZpBw1pYzuN9rvXyWc2CbyTmcyF9KvhsWWGg5Osr36jYGfTWDM +WByN96kzIh2hbqpdmgIkEpHeD12HACO5spIp2yayfqdvOYsV8nuvHBoG2yCRZQTRQu6 iVntuG1Wmf02rrF8kVniUoGdFljOPLUKKK3Hvrh81SImWjVgnsUsJOoxXbkcX3mX50Vb jAfFrszm7gywkHNQ2T5PHcnngLmXnS1OTlSxs5XVQ/QJhmUQNJxFlQaS/ZyYIMN4llND edEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GKHOcU5u; 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 x9si42532058pgp.421.2019.08.05.06.14.16; Mon, 05 Aug 2019 06:14:32 -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=@kernel.org header.s=default header.b=GKHOcU5u; 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 S1730040AbfHENKc (ORCPT + 99 others); Mon, 5 Aug 2019 09:10:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:49380 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729988AbfHENK1 (ORCPT ); Mon, 5 Aug 2019 09:10:27 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 03B872067D; Mon, 5 Aug 2019 13:10:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565010626; bh=rVdNOYNZGUrED489nDxiAoFBEAt2PWzy6ZMn4bS+Tng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GKHOcU5uKZHOVEPDe6KtmFri55Ugh6ShcYfeX0rBw6qIkTME0CRCjOOXPVLRGGyN8 uiOLFeqfXtzKC6HHblrZN5t1VWWP4SELiBpKH94Xdlmzx8wCyuFfbLxmO6HC2pY9yG 65P/DhydnLFRYAskQRrSqGxLSmJu1wvSRbDPNBFk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "M. Vefa Bicakci" , Masahiro Yamada Subject: [PATCH 4.19 42/74] kconfig: Clear "written" flag to avoid data loss Date: Mon, 5 Aug 2019 15:02:55 +0200 Message-Id: <20190805124939.270100307@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190805124935.819068648@linuxfoundation.org> References: <20190805124935.819068648@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 Signed-off-by: Greg Kroah-Hartman --- scripts/kconfig/confdata.c | 4 ++++ 1 file changed, 4 insertions(+) --- 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 @@ next: } fclose(out); + for_all_symbols(i, sym) + sym->flags &= ~SYMBOL_WRITTEN; + if (*tmpname) { strcat(dirname, basename); strcat(dirname, ".old");