From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Subject: [PATCH 1/7] ipv6 addrconf: enable use of proc_dointvec_minmax in addrconf_sysctl Date: Sat, 24 Sep 2016 09:05:03 -0700 Message-ID: <1474733109-18355-1-git-send-email-zenczykowski@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: netdev@vger.kernel.org, Erik Kline , Lorenzo Colitti To: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= , "David S . Miller" Return-path: Received: from mail-pf0-f194.google.com ([209.85.192.194]:35915 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754578AbcIXQGB (ORCPT ); Sat, 24 Sep 2016 12:06:01 -0400 Received: by mail-pf0-f194.google.com with SMTP id n24so6707055pfb.3 for ; Sat, 24 Sep 2016 09:06:01 -0700 (PDT) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: From: Maciej Żenczykowski Signed-off-by: Maciej Żenczykowski --- net/ipv6/addrconf.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 2f1f5d439788..11fa1a5564d4 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -6044,8 +6044,14 @@ static int __addrconf_sysctl_register(struct net *net, char *dev_name, for (i = 0; table[i].data; i++) { table[i].data += (char *)p - (char *)&ipv6_devconf; - table[i].extra1 = idev; /* embedded; no ref */ - table[i].extra2 = net; + /* If one of these is already set, then it is not safe to + * overwrite either of them: this makes proc_dointvec_minmax + * usable. + */ + if (!table[i].extra1 && !table[i].extra2) { + table[i].extra1 = idev; /* embedded; no ref */ + table[i].extra2 = net; + } } snprintf(path, sizeof(path), "net/ipv6/conf/%s", dev_name); -- 2.8.0.rc3.226.g39d4020