From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796361601; b=GwXiG0iF5wROVxO8RAYGImL+i+OcSxuQ0ZVEfUwtPIZd6RHdOzPq2AH/opsOI8AdAunZ or07p2FTzSvx6w2nbiEzwJvv3J/W8EM+tEEnbZ0rLPDO1TdKZqiGpGlFqwDtecC9d/dJD 9Z4rfiJArOZQ6dfb7hZaKzTtbKETgEJ7PX8kgOwmVGG9QpmxMug8U34ck1AzuBDGZvKrD VmmORuS6YamPNYu1ew1ibZGsgZDsli2FhwJcaziUKaweyZbseFst4xCweIlgpBGkQ1fFq IF35hkad/LWS5mtHkkXSF36lF/pQuZBLSkEla3VGIugC7s1zcOBtH1smAHVuvZkAitA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796361601; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=/ctGXaNqkkgTi7Nal5R2hMB+W+CEKVATn/C/3SJb0JI=; b=DIr6HwQdgqJYacCx4Cm7008zusw18tOs7SabJmDqEvHU0MDWRuiRKtw1/FWUBmGra8qo IJlzJNIjYgILCis/mB2dijp9WmiDB6jrfVv5atul8FV4Uq8PF1+qbC4nRl8SQJqoxohr8 n5/VRD8DLOSX/BJC+FSDBC67BJYjebCD7Uvd8ungh8ucxcF0NnjNpL6reronXdoHgPGj4 vlJDFCHNgxXwzJhAYnORg26phZ1F0Ffr8eb/xnQdjFL4fV+El0+yhQ+kVGuTgoqO2adL0 NkW2TQNX/iyDO9rE+t2AaN1aQ59pKRWwMw3vma5q8GnEw4KkvDt9ABRWFzVY6JXJaHQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eu73jbft; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1ABE606A32D for ; Fri, 4 Dec 2026 05:20:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eu73jbft Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B6A81F000CE; Fri, 4 Dec 2026 05:20:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796361600; bh=/ctGXaNqkkgTi7Nal5R2hMB+W+CEKVATn/C/3SJb0JI=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=eu73jbft4PgXDopZl2l1iB4lFDZVSXW5szkkBj3vcPqpp4z/b5PTEV/jcv0Yxbnez iUi+CgL+LB84pdx3JSvaONir8rscp+QoDsJwkLQZMbL2mXdcQjuxEzNe7mKqIS9VEj PMita4d5WPc0id7QjmDc9ykk2XApHsXEXwvXWXrWuYEf7iaMWBQwzS7ZAsg6mfQmsC e8nGmKJEy8+LxMNLsMK3ssoV9uNkxSwdZ9yfllzkPdsjQg0rLZhhPPgK5Cqae8ZmdF VCogqfXpx4F75th640+k14XQv1FqHacTAHTXFFEPnAJz3m6FzRmAEqaqN8VQA+9rVx 2Mba65nr3ILSg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] scsi: libcxgbi: Free the socket on error path in cxgbi_check_route6() Reply-To: sashiko-reviews@lists.linux.dev To: "Haoxiang Li" Cc: linux-scsi@vger.kernel.org In-Reply-To: <20261204045046.1447268-1-haoxiang_li2024@163.com> References: <20261204045046.1447268-1-haoxiang_li2024@163.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 05:19:59 +0000 X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Low] scsi: libcxgbi: resolve IPv6 saddr before cxgbi_sock_create() - [Low] scsi: libcxgbi: changelog omits why cxgbi_sock_closed() leaked csk -- commit 82ba5c15956713e1844bb776bd39db464c5fab3b Author: Haoxiang Li > scsi: libcxgbi: Free the socket on error path in cxgbi_check_route6() > > cxgbi_sock_create() allocates a socket and cpls. If later address > lookup fails, this memory is leaked. Free the cpl buffers and drop > the socket reference directly. > > Fixes: fc8d0590d914 ("libcxgbi: Add ipv6 api to driver") > Signed-off-by: Haoxiang Li [Severity: Low] Could the changelog explain why the previous cxgbi_sock_closed() call leaked the socket? cxgbi_sock_create() initializes csk->state to CTP_CLOSED, so cxgbi_sock_closed() returns early without freeing the cpl skbs or dropping the reference. > diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c > index b0bffbc381834..c77a01cdda24b 100644 > --- a/drivers/scsi/cxgbi/libcxgbi.c > +++ b/drivers/scsi/cxgbi/libcxgbi.c > @@ -820,8 +820,10 @@ cxgbi_check_route6(struct sockaddr *dst_addr, int if= index) > neigh_release(n); > =20 > ip6_rt_put(rt); > - if (csk) > - cxgbi_sock_closed(csk); > + if (csk) { > + cxgbi_sock_free_cpl_skbs(csk); > + cxgbi_sock_put(csk); > + } > err_out: > return ERR_PTR(err); > } [Severity: Low] Would it be simpler to resolve pref_saddr before calling cxgbi_sock_create(), as cxgbi_check_route() does for IPv4? Neither rt6_get_prefsrc() nor ipv6_dev_get_saddr() depends on csk. Moving the lookup earlier avoids allocating and freeing a cxgbi_sock and its cpl skbs on lookup failure, and removes the need for the manual csk teardown block here. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204045046.1447= 268-1-haoxiang_li2024@163.com?part=3D1