Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp17760rdb; Fri, 5 Jan 2024 00:52:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFm0rPQdpRtXoqJeVKlN8/lE8jMp4lyT/fOYbIwI573DbEgQVSy8O6W03WZyEPQN1lBz+0n X-Received: by 2002:a05:6a00:3990:b0:6d9:b4e6:ffb with SMTP id fi16-20020a056a00399000b006d9b4e60ffbmr1967305pfb.0.1704444779090; Fri, 05 Jan 2024 00:52:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704444779; cv=none; d=google.com; s=arc-20160816; b=zIvIiaRfbd2e7a6eTGOkoElyC8fE633WdK4ddPcoq5a5BN+QW84241wl+R6KHA0uA4 NvQWwGgqeBncArijM9wpUMhzXzWQt7u4/1Mqg0bhGQehmEgEv6fuTgqXNKgVJorF9cyw 3secYzzEY8ySAJwQvz3O4L8CVz2sEQPGF29Gt4IqQsFhZOWQfP5ahPq16MNe10nL8Vaj GV6xBDWeVcQeST1mElTwbzWYkJd799CN2ScrjouMgxep9qT2msrupRJdafQMUJO/ah17 Hz3Dc+nRXzR1hiiZEk28yocIHw9ozau4Vem9Xyk0NudP9WTdHIY7PItiMEWghxm0Q4tk jMiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=thread-index:thread-topic:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject :references:in-reply-to:message-id:cc:to:from:date; bh=FtLen1YIrBzqVTQm6qmNI/anyMB8zzgbTwi8V09NM1M=; fh=anRM9t503RB+3BZsi2jzxcaOXBiykw41mucVsmlCR0Y=; b=IOBQmoLjkHXeoL+itfmlelvsqqonVLcv6OnLRlW6W3pM1M8WOtObYSoN3KRSJM8zUA dJH0f2/iSJ0jovQ62nPB4Yi9OxAecX6dIptCzZPk/wfj7JfcmNaJUGo7rCuGAOUM0srX vMyQ1XsCtgAMAFbJIW0IebZ44VRLW3bt0SuVtWj+z8ecB/KaVzReXoZuwToTXY/u7X86 0i2hb4tvImlAym2RgBEHVw41s/LnPdf7u+HmmtBJnlpgAAbaMLi8ITk1U0rIXLeAgIfy YkM4kUoZGU1DA0Qlp1JqEHvO8glzqRNZCF5cfw+ouFcTvna835ragebhfy4J21neqgnz lzLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-17613-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17613-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id eb9-20020a056a004c8900b006dab36291d7si939766pfb.4.2024.01.05.00.52.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 00:52:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17613-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-17613-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17613-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BC4822848E7 for ; Fri, 5 Jan 2024 08:52:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D064E22311; Fri, 5 Jan 2024 08:52:53 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED1DE21A14 for ; Fri, 5 Jan 2024 08:52:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nod.at Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nod.at Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 82308626FB14; Fri, 5 Jan 2024 09:52:46 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id rlU9WQ8SCSZB; Fri, 5 Jan 2024 09:52:45 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id B43AD6342D56; Fri, 5 Jan 2024 09:52:45 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Zaz2zALr2Fu4; Fri, 5 Jan 2024 09:52:45 +0100 (CET) Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lithops.sigma-star.at (Postfix) with ESMTP id 8E620626FB14; Fri, 5 Jan 2024 09:52:45 +0100 (CET) Date: Fri, 5 Jan 2024 09:52:45 +0100 (CET) From: Richard Weinberger To: Johannes Berg Cc: Ma Ke , anton ivanov , xiangyang3@huawei.com, linux-um , linux-kernel Message-ID: <16453028.200994.1704444765347.JavaMail.zimbra@nod.at> In-Reply-To: <1c098c26132b60ebebc46a39e8b7827a29e3a166.camel@sipsolutions.net> References: <20231006122717.3984017-1-make_ruc2021@163.com> <1c098c26132b60ebebc46a39e8b7827a29e3a166.camel@sipsolutions.net> Subject: Re: [PATCH] um: vector: fix return value check in vector_legacy_rx Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailer: Zimbra 8.8.12_GA_3807 (ZimbraWebClient - FF97 (Linux)/8.8.12_GA_3809) Thread-Topic: vector: fix return value check in vector_legacy_rx Thread-Index: ThfY3S6SUQd1Spc5i/7CHHF5qkPNtw== ----- Urspr=C3=BCngliche Mail ----- > Von: "Johannes Berg" > An: "Richard Weinberger" , "Ma Ke" > CC: "richard" , "anton ivanov" , xiangyang3@huawei.com, "linux-um" > , "linux-kernel" > Gesendet: Freitag, 5. Januar 2024 09:42:12 > Betreff: Re: [PATCH] um: vector: fix return value check in vector_legacy_= rx > On Thu, 2024-01-04 at 22:05 +0100, Richard Weinberger wrote: >> On Fri, Oct 6, 2023 at 2:28=E2=80=AFPM Ma Ke wrot= e: >> >=20 >> > In vector_legacy_rx, to avoid an unexpected result returned by >> > pskb_trim, we should check the return value of pskb_trim(). >> >=20 >> > Signed-off-by: Ma Ke >> > --- >> > arch/um/drivers/vector_kern.c | 3 ++- >> > 1 file changed, 2 insertions(+), 1 deletion(-) >> >=20 >> > diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_ke= rn.c >> > index 131b7cb29576..822a8c0cdcc1 100644 >> > --- a/arch/um/drivers/vector_kern.c >> > +++ b/arch/um/drivers/vector_kern.c >> > @@ -890,7 +890,8 @@ static int vector_legacy_rx(struct vector_private = *vp) >> > skb->ip_summed =3D CHECKSUM_UN= NECESSARY; >> > } >> > } >> > - pskb_trim(skb, pkt_len - vp->rx_header_size); >> > + if (pskb_trim(skb, pkt_len - vp->rx_header_siz= e)) >> > + return 0; >>=20 >> I think this adds a memory leak. Also, can pskb_trim() really fail in >> this scenario? >> The function controls skb creation and knows all lengths. >>=20 > We had pretty much the exact same discussion in the other patch ... >=20 > https://patchwork.ozlabs.org/project/linux-um/patch/20231007005104.399467= 8-1-make_ruc2021@163.com/ Yeah, I saw that discussion after commenting to this patch. (My fault, I scanned patchwork bottom up)=20 >=20 > No point arguing with people who care about static checkers only, I > guess. This person here never even came back to respond to the comments, > my take is they're throwing patches over the wall they didn't think > about, just to see what sticks. Drive-by fixes are often a waste of everyone's time. :-( Thanks, //richard