From patchwork Tue Nov 22 15:21:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yonatan cohen X-Patchwork-Id: 9442265 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 C427E605EE for ; Tue, 22 Nov 2016 22:00:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B42BB204C2 for ; Tue, 22 Nov 2016 22:00:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A74B620572; Tue, 22 Nov 2016 22:00:42 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 1F550204C2 for ; Tue, 22 Nov 2016 22:00:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932972AbcKVWAl (ORCPT ); Tue, 22 Nov 2016 17:00:41 -0500 Received: from mail-db5eur01on0057.outbound.protection.outlook.com ([104.47.2.57]:50736 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752395AbcKVWAk (ORCPT ); Tue, 22 Nov 2016 17:00:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=iL/m2XVxOTJQVbrtLKkRcFzvTFG08l9DGb/YdDiReDY=; b=lE/ph77Xp+S1iiZK88cQL09+wWMwIlAKcR2o9C2AzlwL7FP3U2jGFvdssu2z5NLw3nQLgV5UiJu1LsiqyyCPAjFlY6h4XQfHPRZItkvPc9FBP8doKWUOGl2x7EZXvru91wLYQ+tIztUK1N2tAC+CrwOgIU6p8JOktVb0ZniZgDQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yonatanc@mellanox.com; Received: from [10.223.3.93] (193.47.165.251) by DB6PR0501MB2502.eurprd05.prod.outlook.com (10.168.73.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.734.8; Tue, 22 Nov 2016 15:21:21 +0000 Subject: Re: [PATCH 1/7] IB/rxe: Allocate enough space for an IPv6 addr To: Andrew Boyer , , References: <1479479809-10798-1-git-send-email-andrew.boyer@dell.com> From: Yonatan Cohen Message-ID: <975a89bc-033e-14ab-72f2-4244c0205e59@mellanox.com> Date: Tue, 22 Nov 2016 17:21:15 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1479479809-10798-1-git-send-email-andrew.boyer@dell.com> X-Originating-IP: [193.47.165.251] X-ClientProxiedBy: HE1PR0902CA0020.eurprd09.prod.outlook.com (10.171.90.30) To DB6PR0501MB2502.eurprd05.prod.outlook.com (10.168.73.147) X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2502; 2:GI2uri15kxNhxDPyLqLhhPafI7egQkXM512GlQevbF8qO/YOz1ZGLKnIjF7C+ijgi69okub5bUizj/xWGb1A163BfEVkyvTINTopIyzluNuGuoVnUaq/UDaBmdwgzrc7R7wVBnbSyvI64tfBUkhNdT/Hd476BBu7Dd9L0Q0jqTc=; 3:CClwRD0Tyjr5u7S+IUrV2pr9DZ0TMYR0c79qLIz8L+SBEmJBxROFNWhbaThUck+eMgPEG3Zrf5ghVFnKs2/nAqdmP5YMWFZz5/KTm+E4hB++y6X8kNlhLLU495XkEy/5WFL8fg5tlnGfnGqMvk+bibEO4z1KsFAcSGbNXPmW764=; 25:PcKm9Ei/uKWviD4Q2zM/GAwbK9njaIbY+y+ntoZPQ+pHn2THzqiPyi+pA+A+oIlgmGiEc1412W7oh+dBHUI4aqvBTXjoDDvXM6uviOd0YcSj92K96kG7wW78ORKD+ZDPWISsoj/9V5VN7lhSVe7VjLPZ/BNjUt+qpt8LTbOEdOMrfRdBoOEXGy4cLOxeeEA5QjxfTbZE3X/QI+m3mtB4gorUr92uCowkTAsy1mZq391VgfC9DfPmWD906Yak4CrCUzcqgVivprm2pvTDaoafdslp2d/3mL50DNOEPsZLkhmtS5Eccq++P8J8NqZglD3sttmWJ8sMoJRUMhe/cVBgDX5aR7AFO2dhAABRb03gkeoc2UxuE6n7qSmaVtsju885JgLPH5fiajRRumfl1DdqogpYDGL9gHvLYA7w800Nh5USsjdY0vy2JqeAw1oHvpVPMc0PTHheQw+1cQtDtHysjw== X-MS-Office365-Filtering-Correlation-Id: 822570e7-4b79-48d2-9ec5-08d412eb37c7 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DB6PR0501MB2502; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2502; 31:G978pXxL1ZaW3aph+N7i3/XAu2YmtfC9Ulw3J/J6/O5tKi22dha7KWcQXifcndpPrC8KWUH3jNjlmrKVVHA4IrPbZq1JXUDn77KFYdEszlGVDKHPcrDy3fhWhZtr5i2K+ZZ7JpGa5zEv0h2hXOz7gV7oDREaMyYRsXu+1qUksN7fnU3YAdXeXnxfsy0TawbljjDWcGvaJ5UDPbxyk8oGVCPkFWi/DXA1EYH+bMaNU7fsaWx7oMDfqSMhvU1ifHSMRqqhQoyqytMhFXczrtwMCw==; 20:GL/RbYwHyqtZfrgP8Vo6PjqtBCpfEmBcKqzNgRjCbjzoDORgcZZ9+RBov1LPZFuem44Q6+jp20iWBzZVjiYIJjq/agM1nqYx+yK67hXc5fTVDrf7UFP/aIqLR52bYJF8E3FzyWs7kXDCxuE9NviNeODzV+JuOCsK5dNvx3zpiNv+cOpxMLzvdr/59inF2mVQadPUe2mdk3Wp8807abtQdUoVM9B+WcIlcSXHBLfplLf5B4Olt+O8N+mgaJM1u57YO7m12jpcsI/KGXVrLwQwS6eRzuEblXob9JDZXXv+fwzzMgT6PguTYT8l0+cb79VLIG7Xvvz3Q4zt/Tr3hNfItWUGzOLh+Jjb04vg/ULpdW1Lgu/bv5rHSk1W5Q3h/N+4o5ThRlurxS7+8I5+YplsaA6s6608DyBQps1BChb9TXxCqUQkveALQ87JuKyp7LidKCTVeJDXeLTPZrwcmgRmX/QLFnbM8tAUYMxl5FA72uyD3e/JmtrzNk1FQ95mShNv X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(56004941905204); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040307)(6060326)(6045199)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6041248)(6061324); SRVR:DB6PR0501MB2502; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0501MB2502; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2502; 4:maOxs0STajLozUqTAklIHAE8fDL2bqOZV091NnXhCJpnZewhRqvB+aGu/gXfKrbBM4d2Ri4A0Pvmv6KKMon23pYgu2xVnAfgi1vQghX7UfHtAs8vaimRIIYDz5PsLe9EeKKMR3u+bSx7Brp/jLw9VdEYCmv6/jzo3yvqyCLeFpNgzIV4LPZisvf7n8KaaHQZna/l6hgpMiE/3eNSFfkQVOwvQc7nPC8rGcm0IiYinWQolLv+guBTynk6bEnMoYYLn7EfuKPTxInUQCWGX1+xjUWa2Txjq9VZKDqnTM0rVHHK65yOarrKJmxm4lzqjmiTXgwAdaq2E6TQTqK0dRRnUX5KfBteHhJ/d/MVrKvYu0DPJc0tKikW78eRgnyxMxrKzqaWVI0K3SdICyTOohnFJzMpzcWojOAijyO57fMHnLdyFi3G8VlxlXxlycfeK0vMUTKSldcuDLsiQ5cDQ269WcX+xn57alNziHK0pqDUs3F0wDDewL7A9W3kQLuYuJaIyCNvL0MlR9jTfk3kuR+SBJge0d42/tesPA/+Sy/aoEQ= X-Forefront-PRVS: 0134AD334F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6049001)(7916002)(189002)(199003)(24454002)(377454003)(31696002)(6666003)(5660300001)(65826007)(81156014)(7736002)(8666005)(3846002)(2950100002)(6116002)(92566002)(68736007)(83506001)(230700001)(86362001)(36756003)(33646002)(2201001)(65956001)(97736004)(42186005)(54356999)(107886002)(5001770100001)(81166006)(76176999)(105586002)(101416001)(305945005)(106356001)(50986999)(4001350100001)(31686004)(77096005)(2906002)(38730400001)(7846002)(229853002)(8676002)(65806001)(189998001)(64126003)(50466002)(23746002)(66066001)(47776003)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0501MB2502; H:[10.223.3.93]; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; DB6PR0501MB2502; 23:NtoCmoA3kKrx6U2kFQ7NnAm9sDVoXSdhPNy?= =?Windows-1252?Q?LThZJlEBXH0j6u7WbCff3MH3SYrwZutbSql1CeyRVIjZyQfVxHJFr7yV?= =?Windows-1252?Q?t29jk7gmllLD3RvuGeEFJrd6iY6Yov0aSwGEDDkheIhLl1BTmuPE3IgV?= =?Windows-1252?Q?HWXr/jtEnsi8h8r83iPyoK5NweiTltfJ+F0l6fSc2NwybGvREfxxbzhx?= =?Windows-1252?Q?o2AjNDVOa+9qOGDH9pSWCTRsvnTwM4+e3cid8O+oDGG5ceFHE2gimgAT?= =?Windows-1252?Q?xDXrnAdNWgxk382W+lARFjsYeKXZju6Hbq04II6btrfi52chRrBcFo+C?= =?Windows-1252?Q?LE74sYiXrqNCJxX5SPKA39iSPsHJo6ZvJZxw4m2ClCP1I28Ur6xSllWY?= =?Windows-1252?Q?spylGheFpt5PqlVNESQV7l1Gd4OBNFca7J3LFMr/IWLG2zzjrTFAm8wH?= =?Windows-1252?Q?Tfz+rQz8xmmSNqWTBHdBbhRxZGMcAU4MuqSJuur3Rxw1qKmABlsGhQTG?= =?Windows-1252?Q?FRr+ahP8z90euAakCzQVMdb2Nvokby9DvrL5DojKAW1OBFqdgYQ9f8vi?= =?Windows-1252?Q?E2CX8jHK5sBFmNeQTK0nG8ctxXYyd96tkKGmwsJ8RT7z6NW/ci6i5iSQ?= =?Windows-1252?Q?x+dl1JPP/If/XeTVxjFgFGf/v9LeiN9jk3YauuRnni/TRWZhzCJHCltS?= =?Windows-1252?Q?yZ/UEtZccUfhNFsMzhhglFvG5aIGSObH+FRgQc3C8+FUyoZfqSj7KyR2?= =?Windows-1252?Q?4N1aNxXypE5GhdU9qMPWz7hfzR8dH9GkmFrT0yP/6h9yFvJp4BpXX31j?= =?Windows-1252?Q?C0f/KssLsLvtKtq+jRQp0mLJqJizS64tprCDx7DoOS8cFKuRkDx0pCxx?= =?Windows-1252?Q?dzd4DGweit6ofi2pLXUyT4cA+yjkNTRw17VzaOwqoIhBk5bFX4vWMy8d?= =?Windows-1252?Q?T/yM3Z9KMcaYJlixhO9S5hhVjoYf9HxbFORNYHYSnNPUSy1oOxGfWSBy?= =?Windows-1252?Q?nHg0rfVZl/s5ubyViI+XuFyylLYUVqRD59QIrD+86IlU6wE8lvWTD91A?= =?Windows-1252?Q?q0BM3BNkEHAsqOG5CxXpaSmgv4o0brxskb9HOdiniCfxMjz5V9sfgvf8?= =?Windows-1252?Q?PiHPg9oFYWN6NEZV4qe9UwBm7B0TKGCwYB5KUNPhGfR8CGrzoGmY1vye?= =?Windows-1252?Q?1T5lrSzT0qvVBORtbDNSU3pmy7v2WSOWkg2JoNoxwAZA0ggae4ntjlWX?= =?Windows-1252?Q?6x22tRhQD4CQq8fo+o/sISCamyF4ru5/jBSo1a06p87KZfdesdZUjvDd?= =?Windows-1252?Q?h0HPAFadYRA0SVN4PL2vIJmf/3tLxg8Tb5rN6uCjEQApcDBjsIsvk8w3?= =?Windows-1252?Q?5xPFH5+l8PE/at8RrCGAxVNGynHTNVIbdRRCoHNSA5whK2JoOMgZP1bI?= =?Windows-1252?Q?r063Zz5ohSLcg1sUngxRkkOLOxf7inRgadEk27wG6Pw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2502; 6:02hVOfVnf4PgvzMnXQ1dzTPTwshTbV7GPj6bzrw5DJPAA/ZA+ZlNVFqesGYS2ULh3RcLSeqw3g6eS7BvyLmXVGDuV0CIMLYzTbFXq79rRGPtfkYIWgzW9eOYqGVEmo53yqLtVuh44uZ4hcxCkbAZVr4ZOnxcE7e76FbsIRsl6hYZejSXGXmJPaeLMhJZ6OHboaydllCLAkiNHhPpYWFvpfcHG0FXFbachCnrcA1Hu8oeHt6VHX44AQ56QdQaGyvRTqY0KiH5IpptbSwAS/w1JkP+EVbt1SUpW8KI1iUpjneE4GYibFniS8QKbMVj68X8RuGbs/ixe94Pw0CYnZ3pMCFNS5NvUi/bEVjZaVIsaa8r7DA+/6eFlHLUAdC1faSH; 5:v3UkI9isScauL+szpAiEv1q4Oo/W6Pklr8+ButsPSITBmbBDSyhcS8P7z3Pni2wgdiD5+kgOaoZ6zWrnWzBR/3Es5hYJe2B/JYmzRHfSBSqqn5QhrWtfRNo5oS/uYBoonjZqY0uRiiaV3Sh7rdsCBw==; 24:9l2ypwOaD1nSCfs5pzlGOfQP32ejAbEoiOBKvjGQBScuQ7BwDhZLwOR00S7yvnFTwEdgTfXzkLaJzqwKyPR7NZXWq3Lf9lVAbLQB+lNHgQo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2502; 7:5FGxYpNTk8eG3GIKn9Urr1eIUNsC9ZLkdKQ2KfuqkxaM5Mv0P3N8aAqqOT13T5CwudtHEDO9RwM4zAgH/YBPmS3HzbS2Q8/EOzuBNCs2gcAocmxHdmNAOV1sNSulphSZp/LiMAL3DRIp1VTYbfLvZ2un+aXMBx08Kyl1ivpaiYPEfIO+V98CugFK2G3g3gOhJ8R9XfIuR2KJR5t+Yxl3Mzc8IiO/T7uD5diid7a1Jx/79/VYH3FztZauc/YwaIUz0mrkXhspkjT5MkOEu7cbhCqmJbm2R+zgtHDRsAvjomU64LgHMpfyRrWGg6M8uPtQO62rO20jwSqQ+v8Tv+UlLnoraVNWfcnPP8cNYLMSU0w=; 23:ofK5qysOZAvHHGSnfb5LYvAm3IySNvKe6JigZSn8+P2N8WKwkNOU9ClSoXwJpULpyKgCtDg3Hq1/darE8ackKOBrmV8QfPSlC7guZs+aCAtAy8zQhgFM7gzG4F1I19xUEeyf4uLp9dTuNPBg9THJNefmcEy1Lrd0pzeYNMnAEy3cMlRFH+8LnWfaUGET3+ak X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2016 15:21:21.6426 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2502 X-OriginatorOrg: Mellanox.com 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 11/18/2016 4:36 PM, Andrew Boyer wrote: > Avoid smashing the stack when an ICRC error occurs on an IPv6 network. > > Signed-off-by: Andrew Boyer > --- > drivers/infiniband/sw/rxe/rxe_recv.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c > index 46f0628..b40ab8d 100644 > --- a/drivers/infiniband/sw/rxe/rxe_recv.c > +++ b/drivers/infiniband/sw/rxe/rxe_recv.c > @@ -391,7 +391,7 @@ int rxe_rcv(struct sk_buff *skb) > payload_size(pkt)); > calc_icrc = cpu_to_be32(~calc_icrc); > if (unlikely(calc_icrc != pack_icrc)) { > - char saddr[sizeof(struct in6_addr)]; > + char saddr[64]; > > if (skb->protocol == htons(ETH_P_IPV6)) > sprintf(saddr, "%pI6", &ipv6_hdr(skb)->saddr); > you fixed a bug here but i think the following would be better than hard coding 64 bytes on the stack } --- 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 --- a/drivers/infiniband/sw/rxe/rxe_recv.c +++ b/drivers/infiniband/sw/rxe/rxe_recv.c @@ -391,16 +391,14 @@ int rxe_rcv(struct sk_buff *skb) payload_size(pkt)); calc_icrc = cpu_to_be32(~calc_icrc); if (unlikely(calc_icrc != pack_icrc)) { - char saddr[sizeof(struct in6_addr)]; if (skb->protocol == htons(ETH_P_IPV6)) - sprintf(saddr, "%pI6", &ipv6_hdr(skb)->saddr); + pr_warn_ratelimited("bad ICRC from %pI6\n", &ipv6_hdr(skb)->saddr); else if (skb->protocol == htons(ETH_P_IP)) - sprintf(saddr, "%pI4", &ip_hdr(skb)->saddr); + pr_warn_ratelimited("bad ICRC from %pI4\n", &ip_hdr(skb)->saddr); else - sprintf(saddr, "unknown"); + pr_warn_ratelimited("bad ICRC from unknown\n"); - pr_warn_ratelimited("bad ICRC from %s\n", saddr); goto drop;