Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4283192ybi; Mon, 29 Jul 2019 23:09:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzEeRUKUSc78sD5fuW6Mz0miG54EX37ahUaLBeM8wXlDv89r7JAFLQm0xOwLfpL00ZPi4e/ X-Received: by 2002:a17:90a:fa18:: with SMTP id cm24mr112600302pjb.120.1564466947364; Mon, 29 Jul 2019 23:09:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564466947; cv=none; d=google.com; s=arc-20160816; b=MIAywZT9WTJ74l/+VniwY0y7yIefpIV3Ppd2aLNuF35I8ipkvOwI73RX+co81eX/d3 RlyMSKaut17ZRl/Y9XnczQUylNC7dDYezrUDLNHsm8JzWnIUUxakXgrLFvjX+aTP7rBJ T1uBGOcAdARxYMArFEadlIY9vEWRG612wla4f9NPHRZ18KWBxR11wdt05sqdkOt5iW8Q yh6XTr8Qw2gLGZCjq8NEigFbEty73kuXhggUFY2HNueFzhqUmYeuKLe4N0h8tP7d+fJW Blj8rdBem0cMnbDhiW4k3MtIL5MXkM+FMulLU1NSESdXP9u6r7fCFYTTwsiQ30OU5deN v8ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=QrYtXYxZKE6mFRtyvgs8xGM4pvSd2ShYYnY5t0aH2kg=; b=xPnDkKSqRBWjoh3rVR5MMtWH7fRLDDEzLoZ/SMkRxJ23fX9DDGmUSksMHM15yaoyB0 Ab++WyDOFIImy2iPnxCcqjuh7OCjxFSZmS1/aUqcLNUaxNkpCuYl2e0T1g20ohR5iR5Y iNqb/ozDCoD4yt7ez58lACnSANDBiGxVK2ijJGT08HpNumvtBCQZ+/JBA9DpskI+PsMz rPvRjuV+6aZtmET+f4sEG3Ts4xD3wOEuZkAmIQM9PIQgvbJAWGYssV1/07wdtXmHdX1J jzN3Tes5Bbc5i39OZi7tZLtCQbNOKG1zmTCGutrCX+0oEsA+jQE8nkRE06PYVNC67u2d Hfpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b="A/PNe0b7"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g20si28433489pfh.95.2019.07.29.23.08.53; Mon, 29 Jul 2019 23:09:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b="A/PNe0b7"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728265AbfG3GH1 (ORCPT + 99 others); Tue, 30 Jul 2019 02:07:27 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:39710 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726192AbfG3GH1 (ORCPT ); Tue, 30 Jul 2019 02:07:27 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x6U5xGTC035357; Tue, 30 Jul 2019 06:06:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=QrYtXYxZKE6mFRtyvgs8xGM4pvSd2ShYYnY5t0aH2kg=; b=A/PNe0b7QP2TCg+9js+WpJbScFGRlChxzOMzYEo3MT2pnLrz25J1qkn/gcKvMG0wI6b7 BEN6VTlSoBACbmQ8A/X+5K+kFdwXE6nW0kQlOR0Eb3vBT9dIhz2Iwn+TqTLlB/btfSZ+ UzbrdGp/URurPNf+Fo6mFHF4rbao4xG/FEc/Tt2qEhy5dZoQfQWsN8zdqIqNrODOrNNj n/AhyMnNdskatdquNY2un3PwMDO0ZvdlS4d4ilHReMG/7x+QiiJZR2oWIlO50aYgw0cw eThqySkb1r2S69jIRyEQ1ICz2zFs+E3WUM21A3rqJxIevWSLr81t8eZJh3jHgq8hzgFE Fw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2u0e1tm7mr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 30 Jul 2019 06:06:11 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x6U62r7H122543; Tue, 30 Jul 2019 06:06:11 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3020.oracle.com with ESMTP id 2u2ex9jdph-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 30 Jul 2019 06:06:11 +0000 Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x6U664G7021624; Tue, 30 Jul 2019 06:06:07 GMT Received: from [192.168.1.24] (/180.169.93.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 29 Jul 2019 23:06:04 -0700 Subject: Re: [PATCH v2] nbd_genl_status: null check for nla_nest_start To: Navid Emamdoost , josef@toxicpanda.com Cc: kjlu@umn.edu, smccaman@umn.edu, secalert@redhat.com, emamd001@umn.edu, Jens Axboe , linux-block@vger.kernel.org, nbd@other.debian.org, linux-kernel@vger.kernel.org References: <20190729130912.7imtg3hfnvb4lt2y@MacBook-Pro-91.local> <20190729164226.22632-1-navid.emamdoost@gmail.com> From: Bob Liu Message-ID: <1bcb2fc7-f64b-282c-36ab-eda9ccb4601d@oracle.com> Date: Tue, 30 Jul 2019 14:05:59 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190729164226.22632-1-navid.emamdoost@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9333 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1907300064 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9333 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1907300064 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/30/19 12:42 AM, Navid Emamdoost wrote: > nla_nest_start may fail and return NULL. The check is inserted, and > errno is selected based on other call sites within the same source code. > Update: removed extra new line. > > Signed-off-by: Navid Emamdoost > --- > drivers/block/nbd.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c > index 9bcde2325893..2410812d1e82 100644 > --- a/drivers/block/nbd.c > +++ b/drivers/block/nbd.c > @@ -2149,6 +2149,11 @@ static int nbd_genl_status(struct sk_buff *skb, struct genl_info *info) > } > > dev_list = nla_nest_start_noflag(reply, NBD_ATTR_DEVICE_LIST); > + if (!dev_list) { > + ret = -EMSGSIZE; > + goto out; > + } > + > if (index == -1) { > ret = idr_for_each(&nbd_index_idr, &status_cb, reply); > if (ret) { > Looks good to me. Reviewed-by: Bob Liu