Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3107524pxb; Tue, 20 Apr 2021 00:15:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVK2GQfCTuGti1VKYBE77h+ftu4EJjxHrhqAvJcA5vY4uSTfpJuw0pjDPwv6iN6GQIwR4n X-Received: by 2002:a05:6402:785:: with SMTP id d5mr8833724edy.134.1618902935476; Tue, 20 Apr 2021 00:15:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618902935; cv=none; d=google.com; s=arc-20160816; b=fZE6zdbC9Xvx3DZ4k9pgXJ4b6Phq+wVupqqlruauc5eirprekDp1Lv8BjvWtubXTkW EYE9JglJV8sWvfyETp8xgaLa7oofaQ7o0sc/XrF4HDiJWb6S3U7ywfDW6q0L6rrkYaW8 DTGSN8UQSMJ4KsmulxHT0MNTp0cNCDqSvyjYOV06zutBNMx08mJt+JPMPJZ6NK3wq+TE r8XPMXFP2svMJZYT8vFt7GkHE9gKV/zyhH1DzO2iQdqDTyZp9AvvAjx/rILI+NuFtVJE xKmdfEjiMVYXTvvpOwA23ETJOUK17PTHhcPYFYtimxODGf89N9kNz8C5piyjRLxXXpGW fK5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BdE42N1sBiYhYeWABw4lLtIFQswhpP9jbkz22OE11aM=; b=uYkn2HOqMQpuhT+1XWwEibtS/44jhtN476mMlgaZkzDvNmVU14M3/DBLteI0EZkTto oy4J22ushbXvRJ1SOze6C6bmYSVqQrhOJbzyek7jYif1Z8UegS9oztScgnrYhgTCO2K9 Nydw9Wow1X7FnhCggsepVPb1tc4xAhGRY4+SKu4FOM+nPWgmwuH81n6ytKYOSGM7lWwe 8aIS8quY/7zZDe4i7LdBjiWWcz0BF6zpbNsHl+SEFTP4UY8XEQzsiVVhaxA2obCfwHwx kx+xPX4QKjS5JqvxuclFMVv4zgY2DMPTMmY6iCvE6VIk28Sk3ZdROii1x6UdRkV3xK1a boag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oa9Tr1YQ; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w22si14365901edc.204.2021.04.20.00.15.11; Tue, 20 Apr 2021 00:15:35 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=oa9Tr1YQ; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230328AbhDTHNf (ORCPT + 99 others); Tue, 20 Apr 2021 03:13:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:53442 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229793AbhDTHNe (ORCPT ); Tue, 20 Apr 2021 03:13:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6032461154; Tue, 20 Apr 2021 07:13:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618902783; bh=hyy9kPw6FnlS5XBptvg6tMY/F+u5h5oS2Ot4txHGO/A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oa9Tr1YQlFCBMSyE+PhLQrZK+BSOU8Ag1tkJ6g5I0m4Yr1T4JBKLqKpFWqdX/7ixw 9QqF2zAOftabQiNif3NOH89r22UY+ajU/X4uRdJYn5k3avN7h4gTvv7hzYMejViCoA aVRN2hQP3g6HGzQ2dFLDUtZUg2jjIqkxUlCYSCc0= Date: Tue, 20 Apr 2021 09:13:00 +0200 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Aditya Pakki , Santosh Shilimkar , "David S. Miller" , Sasha Levin Subject: Re: [PATCH 5.10 042/103] net/rds: Avoid potential use after free in rds_send_remove_from_sock Message-ID: References: <20210419130527.791982064@linuxfoundation.org> <20210419130529.251281725@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210419130529.251281725@linuxfoundation.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 19, 2021 at 03:05:53PM +0200, Greg Kroah-Hartman wrote: > From: Aditya Pakki > > [ Upstream commit 0c85a7e87465f2d4cbc768e245f4f45b2f299b05 ] > > In case of rs failure in rds_send_remove_from_sock(), the 'rm' resource > is freed and later under spinlock, causing potential use-after-free. > Set the free pointer to NULL to avoid undefined behavior. > > Signed-off-by: Aditya Pakki > Acked-by: Santosh Shilimkar > Signed-off-by: David S. Miller > Signed-off-by: Sasha Levin > --- > net/rds/message.c | 1 + > net/rds/send.c | 2 +- > 2 files changed, 2 insertions(+), 1 deletion(-) > > diff --git a/net/rds/message.c b/net/rds/message.c > index 799034e0f513..4fc66ff0f1ec 100644 > --- a/net/rds/message.c > +++ b/net/rds/message.c > @@ -180,6 +180,7 @@ void rds_message_put(struct rds_message *rm) > rds_message_purge(rm); > > kfree(rm); > + rm = NULL; > } > } > EXPORT_SYMBOL_GPL(rds_message_put); > diff --git a/net/rds/send.c b/net/rds/send.c > index 985d0b7713ac..fe5264b9d4b3 100644 > --- a/net/rds/send.c > +++ b/net/rds/send.c > @@ -665,7 +665,7 @@ static void rds_send_remove_from_sock(struct list_head *messages, int status) > unlock_and_drop: > spin_unlock_irqrestore(&rm->m_rs_lock, flags); > rds_message_put(rm); > - if (was_on_sock) > + if (was_on_sock && rm) > rds_message_put(rm); > } > > -- > 2.30.2 > > > Ah crap, I will go drop this stuff. I also will strongly recommend that all maintainers blacklist umn.edu patches at this point in time, as it is obvious that a professor there is operating a sociological experiment on Linux kernel maintainers and is wasting our time. This is not ok. greg k-h