From patchwork Wed Apr 26 07:46:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Abeni X-Patchwork-Id: 9700517 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 90FA0603F7 for ; Wed, 26 Apr 2017 07:46:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 818DD204C2 for ; Wed, 26 Apr 2017 07:46:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 767AC285EC; Wed, 26 Apr 2017 07:46:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B41E285EB for ; Wed, 26 Apr 2017 07:46:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1953736AbdDZHqm (ORCPT ); Wed, 26 Apr 2017 03:46:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57870 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1955345AbdDZHqi (ORCPT ); Wed, 26 Apr 2017 03:46:38 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 68A3D4E4C6; Wed, 26 Apr 2017 07:46:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 68A3D4E4C6 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=pabeni@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 68A3D4E4C6 Received: from dhcp-176-80.mxp.redhat.com (dhcp-176-80.mxp.redhat.com [10.32.176.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id A366B823D0; Wed, 26 Apr 2017 07:46:35 +0000 (UTC) Message-ID: <1493192794.2409.3.camel@redhat.com> Subject: Re: [PATCH] IB/IPoIB: Check the headroom size From: Paolo Abeni To: Or Gerlitz , Doug Ledford Cc: Erez Shitrit , Honggang LI , Erez Shitrit , "linux-rdma@vger.kernel.org" , Linux Netdev List , David Miller Date: Wed, 26 Apr 2017 09:46:34 +0200 In-Reply-To: References: <1493114155-12101-1-git-send-email-honli@redhat.com> <1493134815.3041.72.camel@redhat.com> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 26 Apr 2017 07:46:37 +0000 (UTC) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, 2017-04-26 at 00:50 +0300, Or Gerlitz wrote: > so maybe @ least for the time being, we should be picking Hong's patch > with proper change log and without the giant stack dump till we have > something better. If you agree, can you do the re-write of the change > log? I think that Hong's patch is following the correct way to fix the issue: ipoib_hard_header() can't assume that the skb headroom is at least IPOIB_HARD_LEN bytes, as wrongly implied by commit fc791b633515 (my fault, I'm sorry). Perhaps we can make the code a little more robust with something alongside the following (only compile tested): --- Paolo -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index d1d3fb7..d53d2e1 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -1160,6 +1160,11 @@ static int ipoib_hard_header(struct sk_buff *skb,                              const void *daddr, const void *saddr, unsigned len)  {         struct ipoib_header *header; +       int ret; + +       ret = skb_cow_head(skb, IPOIB_HARD_LEN); +       if (ret) +               return ret;           header = (struct ipoib_header *) skb_push(skb, sizeof *header); ---