Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1903024pxb; Fri, 5 Mar 2021 02:32:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvINKSzMkQJ6wLXWGfw5sHAy9jQQQl0hJAnIHMFxe1LjBRQMzGw85q/8qZSUXeTYqXWO9F X-Received: by 2002:a05:6402:c7:: with SMTP id i7mr8620635edu.328.1614940367207; Fri, 05 Mar 2021 02:32:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614940367; cv=none; d=google.com; s=arc-20160816; b=NrZshdWaTuVXPwubAr23YA3Uvw/9gEoTiUovGoAGGdMrZL9KIt5oOg/kV+xYm4SFCm sQSXdNVjvSZ/iU8alV1D9Mq1WVIbal1gfPlNu2Y7Aw6sVKQYT/ng/R435IjZP1ppD5TD kKLb0Zi/ZtnsK+AK6orpZyiTxIkA5CenMcGSjIn2t+VQRU8YM1BsTVoUzars0lh49Bew /oZagJTCqsj6vf+nx1CEZEYEL8BUvi0Vf35iw/6WEdUKvL/t6Hatl+iiM3koyxmizmLr j/LWLNGmo3brdTHSFzxfnCY/cP3pa8D6aRltSYKzdMoV0wjGH4Dkrl1dccRSiSRLbgbT u03Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=4UbJnKh/rNouiIUUWZr3ZpULnYtu8wIcqi44QhFm7VQ=; b=J8oREVGmu5fLJtzzKuQNzGNEsp7p0CBBwEuAQjXAG5tvcAm3trUqHVGM04EC82r2fE Tc+04xupl0whqRm90rpk6vy41uc65N2Coad63CSqglElkHvqvKNOPWkJ37imXGGsLbpU g7RtmR1BR6yCV58+Cg2aMeVPSw2hsRLIZAW9Pw7Z3xbygtU8PMZME+NyDoYxV75Iz2ZR MIlXzlIExi9EMBspnVIf/uKxlJVtgKZVB3gZRaKDTj5ruRWS23K9vjsvfx7fIcvdmP6v mqZ9UYKSReYIciBI6VWX81ABH7gZHEP7es5Thfj8f8h9omQCl2TS66HHdU4ht4lDECse SUWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=cIManWSH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f24si1157033ejz.234.2021.03.05.02.32.23; Fri, 05 Mar 2021 02:32:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=cIManWSH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229813AbhCEKa5 (ORCPT + 99 others); Fri, 5 Mar 2021 05:30:57 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57662 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbhCEKa0 (ORCPT ); Fri, 5 Mar 2021 05:30:26 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 125ATGfM002168; Fri, 5 Mar 2021 05:30:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=4UbJnKh/rNouiIUUWZr3ZpULnYtu8wIcqi44QhFm7VQ=; b=cIManWSHycp6SdCZ1FadOLerR/MlP2K2WmPMGZqOEPQdpBCRT4vz3I9I+BZ48RZqdqls H8Tn11W9vC3fxm4ZMQgLzsMtb2G0EAlutXhwOxq51CBEF0sLuBEAqUFKTUYOU2PpXmDJ zG0f0m45HbwfCDk2yOHlmV1qv3r1S/A2MxAwUMZC7dCcq+ZWpClqDJ5ZUn8as8t8GkRe horv+n3OlO8e/dTrmRHxkotO9wADDUBlw1PoBPJGhn66hPW9vqKwC6qXPoSwdiG/MET+ HQqrwFkDzIwoA+luD+7jxK4loDdtcgL5JTyM9Qop/uQWqeJn5g24oslKGaaNrzS2jwrK 3w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 373jxdr13u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 Mar 2021 05:30:24 -0500 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 125AUMqv012206; Fri, 5 Mar 2021 05:30:23 -0500 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 373jxdr12e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 Mar 2021 05:30:22 -0500 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 125AREnQ002959; Fri, 5 Mar 2021 10:30:20 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma06ams.nl.ibm.com with ESMTP id 37293fswbt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 Mar 2021 10:30:20 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 125AUIdc37683680 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 5 Mar 2021 10:30:18 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EE74CA406F; Fri, 5 Mar 2021 10:30:17 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 94C70A4053; Fri, 5 Mar 2021 10:30:17 +0000 (GMT) Received: from [9.171.51.82] (unknown [9.171.51.82]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 5 Mar 2021 10:30:17 +0000 (GMT) Subject: Re: [PATCH] net: smc: fix error return code of smc_diag_dump_proto() To: Jia-Ju Bai , davem@davemloft.net, kuba@kernel.org Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210305101351.14683-1-baijiaju1990@gmail.com> From: Karsten Graul Organization: IBM Deutschland Research & Development GmbH Message-ID: Date: Fri, 5 Mar 2021 11:30:20 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <20210305101351.14683-1-baijiaju1990@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-05_05:2021-03-03,2021-03-05 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 spamscore=0 clxscore=1011 bulkscore=0 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 adultscore=0 phishscore=0 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103050048 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/03/2021 11:13, Jia-Ju Bai wrote: > When the list of head is empty, no error return code of > smc_diag_dump_proto() is assigned. > To fix this bug, rc is assigned with -ENOENT as error return code. Your change would break smc_diag_dump(). When there are no IPv4 sockets (SMCPROTO_SMC) in the list and -ENOENT is returned then smc_diag_dump() will not try to dump any IPv6 sockets (SMCPROTO_SMC6). Returning zero is correct here. > > Reported-by: TOTE Robot > Signed-off-by: Jia-Ju Bai > --- > net/smc/smc_diag.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/net/smc/smc_diag.c b/net/smc/smc_diag.c > index c952986a6aca..a90889482842 100644 > --- a/net/smc/smc_diag.c > +++ b/net/smc/smc_diag.c > @@ -201,8 +201,10 @@ static int smc_diag_dump_proto(struct proto *prot, struct sk_buff *skb, > > read_lock(&prot->h.smc_hash->lock); > head = &prot->h.smc_hash->ht; > - if (hlist_empty(head)) > + if (hlist_empty(head)) { > + rc = -ENOENT; > goto out; > + } > > sk_for_each(sk, head) { > if (!net_eq(sock_net(sk), net)) > -- Karsten (I'm a dude)