From patchwork Wed Dec 7 08:00:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhouyi Zhou X-Patchwork-Id: 9464151 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 895D960236 for ; Wed, 7 Dec 2016 08:00:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79FFF26A99 for ; Wed, 7 Dec 2016 08:00:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CC482847E; Wed, 7 Dec 2016 08: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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 6115026A99 for ; Wed, 7 Dec 2016 08:00:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752340AbcLGIAY (ORCPT ); Wed, 7 Dec 2016 03:00:24 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:35602 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751742AbcLGIAX (ORCPT ); Wed, 7 Dec 2016 03:00:23 -0500 Received: by mail-pf0-f196.google.com with SMTP id i88so10745844pfk.2; Wed, 07 Dec 2016 00:00:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=wTNqsSUJM6zHXjP0CtjOW+KWJ8xHQl9Tn3vICRiADAA=; b=emJoJfvuNh1s1xmlv+SX/nKSekrhNtMBAy/K/0+HAKqke4h0uG13JOcoUphd7ysbmx fJihVH8qv6pv9kHIIF0TtL1upzEqkS1SRqp8CCzN/lwrrUwUipanjkGTaeQXeySVYnki IqoRoZ55wjzAgVfy2udcCZ5texV6lU3/YUGlVNFj1cR4CBugJX0a0LshVLyFr9/oOX0j jxX0z+0zKxa3UE1uU3z7AmZCuDyVJQvCv3zGUxe/dk3dNWt504UrhIq+tEfWp2ZXckRE ZAYE3usFlfkwaFB/RXIR/CO70gG8fmPTd51aTlbwmzMKmAVeEp5N6XQbqOmuFS2QsqNt Cfsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wTNqsSUJM6zHXjP0CtjOW+KWJ8xHQl9Tn3vICRiADAA=; b=fykD92dhCQZeMbEe1tBRlR+Kjiw/0WTiZn++vf6hqC1Cat8m6787UtFA80tKU8q639 cwzA55l9ulRKnBqiMxMrngDbsS0ORPLlLS1PdOk5R+np5irNj5GF8LxK9tFt1soRF94t Xirto+pzemPU7A4HlchXq1i3OU7AJoFIYyqDCzSYWwGOaySjtrI+omn9PH4IUn8ixqR4 YkJowyU35HMHjqlx5gju1hYujhjJUz1LcBm+FLEQ6V3hZi5l7PNmlcEz6zX8eKyNOLuP weAQtB9knaQs33NL5bsMTt9SBH351D2kY+5kgFeKhVNnLfl5fsRvKznlpSishcHHZQHc q1Hw== X-Gm-Message-State: AKaTC021drWtQ26aTZtBzHycT8X0thWfFkhhKA7sY04BYlwXsWAkI4P7nRuKT2sZA8PJpg== X-Received: by 10.84.151.9 with SMTP id i9mr101628018pli.67.1481097622240; Wed, 07 Dec 2016 00:00:22 -0800 (PST) Received: from localhost.localdomain ([124.16.128.66]) by smtp.gmail.com with ESMTPSA id 89sm39990162pfi.70.2016.12.07.00.00.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Dec 2016 00:00:21 -0800 (PST) From: Zhouyi Zhou To: , , , , , Cc: Zhouyi Zhou , Zhouyi Zhou Subject: [PATCH 1/1] scsi: fcoe: return value of skb_linearize should be handled Date: Wed, 7 Dec 2016 16:00:00 +0800 Message-Id: <1481097600-25604-1-git-send-email-zhouzhouyi@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Return value of skb_linearize should be handled. Signed-off-by: Zhouyi Zhou Reviewed-by: Yuval Shaia --- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 6 ++++-- drivers/scsi/fcoe/fcoe.c | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c index f9ddb61..142f7e2 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c @@ -542,8 +542,10 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) return; } - if (skb_is_nonlinear(skb)) - skb_linearize(skb); + if (skb_linearize(skb)) { + kfree_skb(skb); + return; + } mac = eth_hdr(skb)->h_source; dest_mac = eth_hdr(skb)->h_dest; diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index 9bd41a3..4e3499c 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c @@ -1685,7 +1685,10 @@ static void fcoe_recv_frame(struct sk_buff *skb) skb->dev ? skb->dev->name : ""); port = lport_priv(lport); - skb_linearize(skb); /* check for skb_is_nonlinear is within skb_linearize */ + if (skb_linearize(skb)) { + kfree_skb(skb); + return; + } /* * Frame length checks and setting up the header pointers