]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
Revert "net/rds: Avoid potential use after free in rds_send_remove_from_sock"
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 24 Apr 2021 16:32:35 +0000 (09:32 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 24 Apr 2021 16:32:35 +0000 (09:32 -0700)
This reverts commit 0c85a7e87465f2d4cbc768e245f4f45b2f299b05.

The games with 'rm' are on (two separate instances) of a local variable,
and make no difference.

Quoting Aditya Pakki:
 "I was the author of the patch and it was the cause of the giant UMN
  revert.

  The patch is garbage and I was unaware of the steps involved in
  retracting it. I *believed* the maintainers would pull it, given it
  was already under Greg's list. The patch does not introduce any bugs
  but is pointless and is stupid. I accept my incompetence and for not
  requesting a revert earlier."

Link: https://lwn.net/Articles/854319/
Requested-by: Aditya Pakki <pakki001@umn.edu>
Cc: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
net/rds/message.c
net/rds/send.c

index 4fc66ff0f1ece01b3715dc442854d51f5508fc17..799034e0f513d988334280186cbdf255fbf50eb7 100644 (file)
@@ -180,7 +180,6 @@ void rds_message_put(struct rds_message *rm)
                rds_message_purge(rm);
 
                kfree(rm);
-               rm = NULL;
        }
 }
 EXPORT_SYMBOL_GPL(rds_message_put);
index fe5264b9d4b36aaebfc27b6f3354d750bf8e22d5..985d0b7713acc5f0f3e31c5944348322e3879c5f 100644 (file)
@@ -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 && rm)
+               if (was_on_sock)
                        rds_message_put(rm);
        }