From patchwork Wed Feb 27 18:19:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 1049084 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="kBY+67Rn"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 448kV30YCZz9s00 for ; Thu, 28 Feb 2019 05:19:22 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730244AbfB0STR (ORCPT ); Wed, 27 Feb 2019 13:19:17 -0500 Received: from mail-qt1-f201.google.com ([209.85.160.201]:49856 "EHLO mail-qt1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729986AbfB0STR (ORCPT ); Wed, 27 Feb 2019 13:19:17 -0500 Received: by mail-qt1-f201.google.com with SMTP id q11so16022243qtj.16 for ; Wed, 27 Feb 2019 10:19:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=UpQ34x9CJVo3jIMuwrBGFvwnwF44v09YiYrvYmOwAnw=; b=kBY+67RnConXudAKvBsaaC/cxQHODIak9C5jRm/kYX6Xs9VWyQuFJMpLGonDuRuCwc cUOqVFSUAaRS7sudGD6pNMX2GGjHvc+r7nevfstPhDUMNZUfMVlx7CpyljKMGiOamLxa hLnhNxcepKnr/T5zTYEiGor79r/0g4GnC6nD/Ke2Tt0Vj8JP6jTuCX3x3y6NV7tWhvTc 6qxsEUyM9dvTmVv+0IMt4I9niLEgC/bWN3mqu8o9oudt3Uw3NZWKEceaDoGzNF4TPEU4 scwRM2+CLZReB+pmDED7HA9dR3EnlTTpzYTxFbxryiHhrKFGquemMw9QtsyeaqlVYbr4 MGVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=UpQ34x9CJVo3jIMuwrBGFvwnwF44v09YiYrvYmOwAnw=; b=d48WR6fE4Y/iFtRf0C5xmNpXRdvKbzN2ufbv2+7htTOWrporKMDd0qv3PJxxjwlThD VbYa3bhscRwAvEFfDeAwe9CL/CS+Da/jNSUqrPce3CCqXLFSpLlLEynPP0veBlkm4LCK V/QajLwlgzBTW0CPi2Zr2ifcVqUultXSAx4Ur8T6quULiaMYsh8mGlZxcFbAL7Rvae8c u9+P2I01XRI69wQ0guWaGw2aQ4I+aEu8k29Rnzj2fwlly7pTDCMGU3tXOfdoyX48LP5m n32jnYQC35Z+tBuKFSKIL0pUfNTw5g/JLGsVWiXRuAZqhQBMS1aEGSywOHVApszAadEe W+sg== X-Gm-Message-State: APjAAAVSlMEeE40LbsXOkA1J5ydUOm+SXouCJNtaN4yWyVecPkxst843 qB0WpMFSFn1C28MCyfO34LneGggqsAVPa9Y0YEg= X-Google-Smtp-Source: APXvYqyTEcfylfczLKKO+Uy3tBvxna+EpFnnsCLzBzUf1+5vsWgzdiYRmBZMAZARQaM4nKu2x2jqf/A/627mC/pZyrE= X-Received: by 2002:a05:6214:1048:: with SMTP id l8mr1473264qvr.46.1551291556128; Wed, 27 Feb 2019 10:19:16 -0800 (PST) Date: Wed, 27 Feb 2019 10:19:10 -0800 Message-Id: <20190227181910.229008-1-samitolvanen@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.21.0.rc2.261.ga7da99ff1b-goog Subject: [PATCH] netfilter: xt_IDLETIMER: fix sysfs callback function type From: Sami Tolvanen To: Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal Cc: "David S . Miller" , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Sami Tolvanen Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Use struct device_attribute instead of struct idletimer_tg_attr, and the correct callback function type to avoid indirect call mismatches with Control Flow Integrity checking. Signed-off-by: Sami Tolvanen --- net/netfilter/xt_IDLETIMER.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/net/netfilter/xt_IDLETIMER.c b/net/netfilter/xt_IDLETIMER.c index eb4cbd244c3d..5f9b37e12801 100644 --- a/net/netfilter/xt_IDLETIMER.c +++ b/net/netfilter/xt_IDLETIMER.c @@ -41,19 +41,13 @@ #include #include -struct idletimer_tg_attr { - struct attribute attr; - ssize_t (*show)(struct kobject *kobj, - struct attribute *attr, char *buf); -}; - struct idletimer_tg { struct list_head entry; struct timer_list timer; struct work_struct work; struct kobject *kobj; - struct idletimer_tg_attr attr; + struct device_attribute attr; unsigned int refcnt; }; @@ -76,15 +70,15 @@ struct idletimer_tg *__idletimer_tg_find_by_label(const char *label) return NULL; } -static ssize_t idletimer_tg_show(struct kobject *kobj, struct attribute *attr, - char *buf) +static ssize_t idletimer_tg_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct idletimer_tg *timer; unsigned long expires = 0; mutex_lock(&list_mutex); - timer = __idletimer_tg_find_by_label(attr->name); + timer = __idletimer_tg_find_by_label(attr->attr.name); if (timer) expires = timer->timer.expires;