From patchwork Wed Dec 7 08:28:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 9464165 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 34C6060512 for ; Wed, 7 Dec 2016 08:28:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 233A028433 for ; Wed, 7 Dec 2016 08:28:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16E9228497; Wed, 7 Dec 2016 08:28:28 +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 9199328433 for ; Wed, 7 Dec 2016 08:28:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752297AbcLGI2L (ORCPT ); Wed, 7 Dec 2016 03:28:11 -0500 Received: from mx2.suse.de ([195.135.220.15]:33222 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752265AbcLGI2K (ORCPT ); Wed, 7 Dec 2016 03:28:10 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3462BABD1; Wed, 7 Dec 2016 08:28:06 +0000 (UTC) Date: Wed, 7 Dec 2016 09:28:01 +0100 From: Johannes Thumshirn To: Zhouyi Zhou Cc: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, jth@kernel.org, fcoe-devel@open-fcoe.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Zhouyi Zhou , Chad Dupuis Subject: Re: [PATCH 1/1] scsi: fcoe: return value of skb_linearize should be handled Message-ID: <20161207082801.GA3688@linux-x5ow.site> References: <1481097600-25604-1-git-send-email-zhouzhouyi@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1481097600-25604-1-git-send-email-zhouzhouyi@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) 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 Hi Zhouyi, On Wed, Dec 07, 2016 at 04:00:00PM +0800, Zhouyi Zhou wrote: > 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 > -- > 1.9.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html I'd personally prefer something like: For bnx2fc as well if Chad agrees. Thanks, Johannes diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index 9bd41a3..bc6fa6c 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c @@ -1673,8 +1673,7 @@ static void fcoe_recv_frame(struct sk_buff *skb) lport = fr->fr_dev; if (unlikely(!lport)) { FCOE_NETDEV_DBG(skb->dev, "NULL lport in skb\n"); - kfree_skb(skb); - return; + goto free_skb; } FCOE_NETDEV_DBG(skb->dev, @@ -1685,8 +1684,8 @@ 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)) + goto free_skb; /* * Frame length checks and setting up the header pointers * was done in fcoe_rcv already. @@ -1732,6 +1731,7 @@ static void fcoe_recv_frame(struct sk_buff *skb) drop: stats->ErrorFrames++; put_cpu(); +free_skb: kfree_skb(skb); }