Tom Rix faad6cebde scsi: sr: Do not leak information in ioctl
sr_ioctl.c uses this pattern:

  result = sr_do_ioctl(cd, &cgc);
  to-user = buffer[];
  kfree(buffer);
  return result;

Use of a buffer without checking leaks information. Check result and jump
over the use of buffer if there is an error.

  result = sr_do_ioctl(cd, &cgc);
  if (result)
    goto err;
  to-user = buffer[];
err:
  kfree(buffer);
  return result;

Additionally, initialize the buffer to zero.

This problem can be seen in the 2.4.0 kernel.

Link: https://lore.kernel.org/r/20220411174756.2418435-1-trix@redhat.com
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-04-18 22:48:31 -04:00
..
2022-04-11 22:09:35 -04:00
2022-04-11 22:09:35 -04:00
2022-03-24 19:37:53 -07:00
2022-03-24 19:37:53 -07:00
2021-11-05 08:42:02 -07:00
2022-03-24 19:37:53 -07:00
2022-03-24 19:37:53 -07:00
2022-03-24 19:37:53 -07:00
2021-01-22 21:14:08 -05:00
2021-01-22 21:14:07 -05:00
2022-02-22 21:11:02 -05:00
2021-01-22 21:14:08 -05:00
2022-01-14 14:37:34 +01:00
2020-09-02 22:49:06 -04:00
2021-10-16 21:45:56 -04:00
2022-02-22 21:11:02 -05:00
2021-04-13 00:20:48 -04:00
2022-01-25 00:09:41 -05:00
2022-02-22 21:11:02 -05:00
2021-03-24 23:03:43 -04:00
2022-03-24 19:37:53 -07:00
2022-01-22 08:33:37 +02:00
2022-02-02 07:49:59 -07:00
2022-02-22 21:11:08 -05:00
2022-03-08 19:40:00 -07:00
2022-03-24 19:37:53 -07:00
2021-12-22 23:41:13 -05:00
2022-03-24 19:37:53 -07:00
2021-04-13 00:20:48 -04:00