]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
s390/dasd: Fix potential NULL pointer dereference
authorJan Höppner <hoeppner@linux.ibm.com>
Mon, 27 Jul 2026 14:28:39 +0000 (16:28 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 31 Jul 2026 14:28:06 +0000 (08:28 -0600)
dasd_release_space() checks the implementation of the is_ese()
discipline function before calling it to determine if a given device is
an ESE DASD.

The current usage of the logical AND operator will lead to a NULL
pointer dereference as the function is called even if the function
pointer is NULL.

Fix this by using the logical OR operator.

Fixes: 91dc4a197569 ("s390/dasd: Add new ioctl to release space")
Cc: stable@vger.kernel.org # v5.3+
Reported-by: Vasily Gorbik <gor@linux.ibm.com>
Acked-by: Eduard Shishkin <edward6@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Link: https://patch.msgid.link/20260727142840.567286-3-sth@linux.ibm.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/s390/block/dasd_ioctl.c

index c85ee42732a30d0f06e9f1d8fe97c8a39c514642..e5b8b413f5abfe2fa6df3b04cd8ca0fccbfa5013 100644 (file)
@@ -324,7 +324,7 @@ out_err:
 static int dasd_release_space(struct dasd_device *device,
                              struct format_data_t *rdata)
 {
-       if (!device->discipline->is_ese && !device->discipline->is_ese(device))
+       if (!device->discipline->is_ese || !device->discipline->is_ese(device))
                return -ENOTSUPP;
        if (!device->discipline->release_space)
                return -ENOTSUPP;