From patchwork Tue Jan 27 09:00:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fan Du X-Patchwork-Id: 433279 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A85AC14011D for ; Tue, 27 Jan 2015 20:04:40 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751663AbbA0JEf (ORCPT ); Tue, 27 Jan 2015 04:04:35 -0500 Received: from mga11.intel.com ([192.55.52.93]:29096 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751125AbbA0JEd (ORCPT ); Tue, 27 Jan 2015 04:04:33 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 27 Jan 2015 01:04:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,473,1418112000"; d="scan'208";a="657163501" Received: from dufan-optiplex-9010.bj.intel.com ([10.238.155.116]) by fmsmga001.fm.intel.com with ESMTP; 27 Jan 2015 01:04:26 -0800 From: Fan Du To: steffen.klassert@secunet.com Cc: herbert@gondor.apana.org.au, davem@davemloft.net, netdev@vger.kernel.org, fengyuleidian0615@gmail.com Subject: [PATCHv3 ipsec-next] xfrm: Do not parse 32bits compiled xfrm netlink msg on 64bits host Date: Tue, 27 Jan 2015 17:00:29 +0800 Message-Id: <1422349230-17394-1-git-send-email-fan.du@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <20150127.001226.711259930266409202.davem () davemloft ! net> References: <20150127.001226.711259930266409202.davem () davemloft ! net> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org structure like xfrm_usersa_info or xfrm_userpolicy_info has different sizeof when compiled as 32bits and 64bits due to not appending pack attribute in their definition. This will result in broken SA and SP information when user trying to configure them through netlink interface. Inform user land about this situation instead of keeping silent, the upper test scripts would behave accordingly. Quotes from: http://marc.info/?l=linux-netdev&m=142226348715503&w=2 > > Before a clean solution show up, I think it's better to warn user in some way > like http://patchwork.ozlabs.org/patch/323842/ did. Otherwise, many people > who stuck there will always spend time and try to fix this issue in whatever way. Yes, this is the first thing we should do. I'm willing to accept a patch Signed-off-by: Fan Du --- ChangeLog: v3: - Use -ENOTSUPP to honor error code rules v2: - Rebase with latest tree --- net/xfrm/xfrm_user.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 8128594..f960bd9 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -2419,6 +2419,11 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) const struct xfrm_link *link; int type, err; +#ifdef CONFIG_COMPAT + if (is_compat_task()) + return -ENOTSUPP; +#endif + type = nlh->nlmsg_type; if (type > XFRM_MSG_MAX) return -EINVAL;