[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200520194147.127137-1-jhubbard@nvidia.com>
Date: Wed, 20 May 2020 12:41:47 -0700
From: John Hubbard <jhubbard@...dia.com>
To: <syzbot+118ac0af4ac7f785a45b@...kaller.appspotmail.com>
CC: <akpm@...ux-foundation.org>, <davem@...emloft.net>,
<jhubbard@...dia.com>, <kuba@...nel.org>,
<linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>,
<linux-rdma@...r.kernel.org>, <netdev@...r.kernel.org>,
<rds-devel@....oracle.com>, <santosh.shilimkar@...cle.com>,
<syzkaller-bugs@...glegroups.com>
Subject: [PATCH] rds: fix crash in rds_info_getsockopt()
The conversion to pin_user_pages() had a bug: it overlooked
the case of allocation of pages failing. Fix that by restoring
an equivalent check.
Reported-by: syzbot+118ac0af4ac7f785a45b@...kaller.appspotmail.com
Fixes: dbfe7d74376e ("rds: convert get_user_pages() --> pin_user_pages()")
Cc: David S. Miller <davem@...emloft.net>
Cc: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org
Cc: linux-rdma@...r.kernel.org
Cc: rds-devel@....oracle.com
Signed-off-by: John Hubbard <jhubbard@...dia.com>
---
net/rds/info.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/rds/info.c b/net/rds/info.c
index e1d63563e81c..b6b46a8214a0 100644
--- a/net/rds/info.c
+++ b/net/rds/info.c
@@ -234,7 +234,8 @@ int rds_info_getsockopt(struct socket *sock, int optname, char __user *optval,
ret = -EFAULT;
out:
- unpin_user_pages(pages, nr_pages);
+ if (pages)
+ unpin_user_pages(pages, nr_pages);
kfree(pages);
return ret;
--
2.26.2
Powered by blists - more mailing lists