[nfs-utils PATCH] nfsdcld: don't send null client ids to the kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It's apparently possible for the sqlite database to get corrupted and
cause one or more rows to have null in the id column.

The knfsd fix was posted here:
https://lore.kernel.org/linux-nfs/20240903111446.659884-1-lilingfeng3@xxxxxxxxxx/

nfsdcld should have a similar fix.  If we encounter a client record with
a null id, just skip it instead of sending it to the kernel.

Signed-off-by: Scott Mayhew <smayhew@xxxxxxxxxx>
---
 utils/nfsdcld/sqlite.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/utils/nfsdcld/sqlite.c b/utils/nfsdcld/sqlite.c
index 03016fb9..88636848 100644
--- a/utils/nfsdcld/sqlite.c
+++ b/utils/nfsdcld/sqlite.c
@@ -1337,6 +1337,11 @@ sqlite_iterate_recovery(int (*cb)(struct cld_client *clnt), struct cld_client *c
 		id_len = sqlite3_column_bytes(stmt, 0);
 		if (id_len > NFS4_OPAQUE_LIMIT)
 			id_len = NFS4_OPAQUE_LIMIT;
+		if (id_len == 0) {
+			xlog(L_ERROR, "%s: Skipping client record with null id",
+				__func__);
+			continue;
+		}
 
 		memset(&cmsg->cm_u, 0, sizeof(cmsg->cm_u));
 #if UPCALL_VERSION >= 2
-- 
2.46.0





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux