BUG: can create 64-bit arrays using dlpack when x64 is disabled
### Description

Repro:
```python
import tensorflow as tf
import jax
import jax.dlpack

assert not jax.config.jax_enable_x64
x = jax.dlpack.from_dlpack(tf.experimental.dlpack.to_dlpack(tf.ones(5, tf.int64)))
assert x.dtype == jax.numpy.int64
```

This can cause loud and confusing errors down the line when our MHLO expects 32-bit numbers but gets 64-bit. For example, with our illegal 64-bit `x` array, try doing `x[0]`.

### What jax/jaxlib version are you using?

HEAD/0.3.15

### Which accelerator(s) are you using?

CPU

### Additional System Info

_No response_
diff --git a/jax/_src/dlpack.py b/jax/_src/dlpack.py
index b861370d4..64d79ee5a 100644
--- a/jax/_src/dlpack.py
+++ b/jax/_src/dlpack.py
@@ -70,4 +70,5 @@ def from_dlpack(dlpack):
   xla_shape = buf.xla_shape()
   assert not xla_shape.is_tuple()
   aval = core.ShapedArray(xla_shape.dimensions(), xla_shape.numpy_dtype())
-  return dispatch.maybe_create_array_from_da(buf, aval, buf.device())
+  return jnp.asarray(           # asarray ensures dtype canonicalization
+      dispatch.maybe_create_array_from_da(buf, aval, buf.device()))
diff --git a/tests/array_interoperability_test.py b/tests/array_interoperability_test.py
index cc2f3a6c0..2da473275 100644
--- a/tests/array_interoperability_test.py
+++ b/tests/array_interoperability_test.py
@@ -137,6 +137,14 @@ class DLPackTest(jtu.JaxTestCase):
     y = tf.experimental.dlpack.from_dlpack(dlpack)
     self.assertAllClose(np, y.numpy())
 
+  @unittest.skipIf(not tf, "Test requires TensorFlow")
+  def testTensorFlowToJaxInt64(self):
+    # See https://github.com/google/jax/issues/11895
+    x = jax.dlpack.from_dlpack(
+        tf.experimental.dlpack.to_dlpack(tf.ones((2, 3), tf.int64)))
+    dtype_expected = jnp.int64 if config.x64_enabled else jnp.int32
+    self.assertEqual(x.dtype, dtype_expected)
+
   @jtu.sample_product(
     shape=all_shapes,
     dtype=torch_dtypes,
@@ -182,6 +190,14 @@ class DLPackTest(jtu.JaxTestCase):
     y = torch.utils.dlpack.from_dlpack(dlpack)
     self.assertAllClose(np, y.cpu().numpy())
 
+  @unittest.skipIf(not torch, "Test requires PyTorch")
+  def testTorchToJaxInt64(self):
+    # See https://github.com/google/jax/issues/11895
+    x = jax.dlpack.from_dlpack(
+        torch.utils.dlpack.to_dlpack(torch.ones((2, 3), dtype=torch.int64)))
+    dtype_expected = jnp.int64 if config.x64_enabled else jnp.int32
+    self.assertEqual(x.dtype, dtype_expected)
+
   @jtu.sample_product(
     shape=all_shapes,
     dtype=torch_dtypes,
['tests/array_interoperability_test.py', 'jax/_src/dlpack.py']